Merge lp:~pshchelo/olive/bugfix_lp632336 into lp:olive

Proposed by Pavlo Shchelokovskyy on 2011-01-14
Status: Merged
Approved by: Jelmer Vernooij on 2011-06-11
Approved revision: 696
Merged at revision: 696
Proposed branch: lp:~pshchelo/olive/bugfix_lp632336
Merge into: lp:olive
Diff against target: 158 lines (+40/-29)
5 files modified
olive/__init__.py (+4/-3)
olive/guifiles.py (+27/-21)
olive/info.py (+3/-2)
olive/window.py (+3/-2)
setup.py (+3/-1)
To merge this branch: bzr merge lp:~pshchelo/olive/bugfix_lp632336
Reviewer Review Type Date Requested Status
Jelmer Vernooij (community) code Approve on 2011-02-17
Olive Team 2011-01-14 Pending
Review via email: mp+46272@code.launchpad.net

Description of the change

added olive-specific icons and functions for handling them

To post a comment you must log in.
lp:~pshchelo/olive/bugfix_lp632336 updated on 2011-02-07
696. By Pavlo Shchelokovskyy on 2011-02-07

removed one forgotten debug line

Jelmer Vernooij (jelmer) wrote :

Thanks! Please merge.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'olive/__init__.py'
2--- olive/__init__.py 2010-06-17 20:27:53 +0000
3+++ olive/__init__.py 2011-02-07 09:51:34 +0000
4@@ -58,7 +58,8 @@
5
6 def about():
7 """ Display the AboutDialog. """
8- from bzrlib.plugins.gtk import __version__, icon_path
9+ from bzrlib.plugins.gtk import __version__
10+ from guifiles import olive_icon_path
11
12 dialog = gtk.AboutDialog()
13 dialog.set_name("Olive")
14@@ -66,8 +67,8 @@
15 dialog.set_copyright("Copyright (C) 2006-2008 Szilveszter Farkas (Phanatic)")
16 dialog.set_website("https://launchpad.net/bzr-gtk")
17 dialog.set_website_label("https://launchpad.net/bzr-gtk")
18- dialog.set_icon_from_file(icon_path("oliveicon2.png"))
19- dialog.set_logo(gtk.gdk.pixbuf_new_from_file(icon_path("oliveicon2.png")))
20+ dialog.set_icon_from_file(olive_icon_path("oliveicon2.png"))
21+ dialog.set_logo(gtk.gdk.pixbuf_new_from_file(olive_icon_path("oliveicon2.png")))
22 dialog.set_authors([ _i18n("Lead Developer:"),
23 "Szilveszter Farkas <szilveszter.farkas@gmail.com>",
24 _i18n("Contributors:"),
25
26=== modified file 'olive/guifiles.py'
27--- olive/guifiles.py 2010-05-25 17:10:52 +0000
28+++ olive/guifiles.py 2011-02-07 09:51:34 +0000
29@@ -12,36 +12,42 @@
30 # along with this program; if not, write to the Free Software
31 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32
33-"""cmenu.ui path"""
34+"""cmenu.ui and icons path"""
35
36 import os
37 import sys
38
39 from bzrlib.plugins.gtk import _i18n
40
41-UIFILENAMES = ["/usr/share/olive/cmenu.ui",
42- "/usr/local/share/olive/cmenu.ui",
43- "/opt/share/olive/cmenu.ui",
44- "/opt/local/share/olive/cmenu.ui",
45- "~/share/olive/cmenu.ui",
46- ]
47+def olive_data_basedirs():
48+ _dir=os.path.dirname(__file__)
49+ return [_dir,
50+ os.path.dirname(_dir),
51+ os.path.expanduser("~/share/olive"),
52+ "/usr/share/olive",
53+ "/usr/local/share/olive",
54+ "/opt/share/olive",
55+ "/opt/local/share/olive",
56+ ]
57+
58+def olive_data_path(*args):
59+ for basedir in olive_data_basedirs():
60+ path = os.path.join(basedir, *args)
61+ if os.path.exists(path):
62+ return path
63+ return None
64+
65+def olive_icon_path(*args):
66+ return olive_data_path(os.path.join('icons', *args))
67
68 # Get the glade file name
69+UIFILENAME = olive_data_path('cmenu.ui')
70+
71 if sys.platform == 'win32':
72- UIFILENAMES = [os.path.join(os.path.dirname(sys.executable),
73- "share/olive/cmenu.ui")]
74-
75-dir_ = os.path.split(os.path.dirname(__file__))[0]
76-# Check first if we are running from source
77-UIFILENAMES.insert(0, os.path.join(dir_, "cmenu.ui"))
78-
79-UIFILENAME = None
80-
81-for path in UIFILENAMES:
82- path = os.path.expanduser(path)
83- if os.path.isfile(path):
84- UIFILENAME = path
85- break
86+ UIFILENAME = os.path.join(os.path.dirname(sys.executable),
87+ "share/olive/cmenu.ui")
88+ if not os.path.exists(path):
89+ UIFILENAME=None
90
91 if UIFILENAME is None:
92 # Fail
93
94=== added directory 'olive/icons'
95=== added file 'olive/icons/olive-gtk.png'
96Binary files olive/icons/olive-gtk.png 1970-01-01 00:00:00 +0000 and olive/icons/olive-gtk.png 2011-02-07 09:51:34 +0000 differ
97=== added file 'olive/icons/oliveicon2.png'
98Binary files olive/icons/oliveicon2.png 1970-01-01 00:00:00 +0000 and olive/icons/oliveicon2.png 2011-02-07 09:51:34 +0000 differ
99=== modified file 'olive/info.py'
100--- olive/info.py 2010-05-25 17:10:52 +0000
101+++ olive/info.py 2011-02-07 09:51:34 +0000
102@@ -29,6 +29,7 @@
103 from bzrlib.plugins.gtk import _i18n, icon_path
104 from bzrlib.plugins.gtk.dialog import error_dialog
105
106+from guifiles import olive_icon_path
107
108 def info(location):
109 """ Get info about branch, working tree, and repository
110@@ -160,8 +161,8 @@
111 parent = None,
112 flags=0,
113 buttons=None)
114- self.window.set_icon_list(gtk.gdk.pixbuf_new_from_file(icon_path("oliveicon2.png")),
115- gtk.gdk.pixbuf_new_from_file(icon_path("olive-gtk.png")))
116+ self.window.set_icon_list(gtk.gdk.pixbuf_new_from_file(olive_icon_path("oliveicon2.png")),
117+ gtk.gdk.pixbuf_new_from_file(olive_icon_path("olive-gtk.png")))
118 self.window.vbox.set_spacing(3)
119 self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NORMAL)
120
121
122=== modified file 'olive/window.py'
123--- olive/window.py 2010-05-25 17:10:52 +0000
124+++ olive/window.py 2011-02-07 09:51:34 +0000
125@@ -23,6 +23,7 @@
126
127 from bzrlib.plugins.gtk import _i18n, icon_path
128
129+from guifiles import olive_icon_path
130
131 class OliveGui(gtk.Window):
132 """ Olive main window """
133@@ -34,8 +35,8 @@
134 # Initialise window
135 gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
136 self.set_title(_i18n("Olive - Bazaar GUI"))
137- self.set_icon_list(gtk.gdk.pixbuf_new_from_file(icon_path("oliveicon2.png")),
138- gtk.gdk.pixbuf_new_from_file(icon_path("olive-gtk.png")),
139+ self.set_icon_list(gtk.gdk.pixbuf_new_from_file(olive_icon_path("oliveicon2.png")),
140+ gtk.gdk.pixbuf_new_from_file(olive_icon_path("olive-gtk.png")),
141 # Who has the svg version of the icon? Would be nice to include
142 #gtk.gdk.pixbuf_new_from_file(icon_path("olive.svg"))
143 )
144
145=== modified file 'setup.py'
146--- setup.py 2010-05-25 17:09:02 +0000
147+++ setup.py 2011-02-07 09:51:34 +0000
148@@ -67,7 +67,9 @@
149 ],
150 data_files=[('share/olive', ['cmenu.ui',]),
151 ('share/applications', ['olive-gtk.desktop', ]),
152- ('share/pixmaps', ['icons/olive-gtk.png']),
153+ ('share/olive/icons', ['olive/icons/olive-gtk.png',
154+ 'olive/icons/oliveicon2.png']),
155+ ('share/pixmaps', ['olive/icons/olive-gtk.png',]),
156 ],
157 cmdclass={'install_data': InstallData}
158 )

Subscribers

People subscribed via source and target branches