Merge lp:~laszlok/jokosher/main into lp:jokosher

Proposed by Laszlo Pandy
Status: Merged
Merged at revision: not available
Proposed branch: lp:~laszlok/jokosher/main
Merge into: lp:jokosher
Diff against target: 142 lines (+70/-6)
4 files modified
Jokosher/Extension.py (+6/-1)
Jokosher/PlatformUtils/Unix.py (+7/-0)
Jokosher/ui/StatusBar.py (+35/-5)
extensions/Fullscreen.py (+22/-0)
To merge this branch: bzr merge lp:~laszlok/jokosher/main
Reviewer Review Type Date Requested Status
Jokosher Code Pending
Review via email: mp+17990@code.launchpad.net
To post a comment you must log in.
lp:~laszlok/jokosher/main updated
1193. By Laszlo Pandy

Fix unicode handling of paths.
This fix only changes the unix module. This same bug needs to be tested on Windows.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Jokosher/Extension.py'
--- Jokosher/Extension.py 2009-05-29 00:49:54 +0000
+++ Jokosher/Extension.py 2010-01-26 05:33:14 +0000
@@ -145,6 +145,7 @@
145 mainapp -- reference the MainApp Jokosher window.145 mainapp -- reference the MainApp Jokosher window.
146 """146 """
147 self.mainapp = mainapp147 self.mainapp = mainapp
148 self.jokosher = mainapp
148 149
149 self.CONFIGPATH = os.path.join(EXTENSION_DIR_USER, '../extension-config')150 self.CONFIGPATH = os.path.join(EXTENSION_DIR_USER, '../extension-config')
150 self.DATAPATH = os.path.join(EXTENSION_DIR_USER, '../extension-data')151 self.DATAPATH = os.path.join(EXTENSION_DIR_USER, '../extension-data')
@@ -181,7 +182,11 @@
181 reference to the new menu item.182 reference to the new menu item.
182 """183 """
183 extensions_menu = self.mainapp.wTree.get_widget("extensionsmenu").get_submenu()184 extensions_menu = self.mainapp.wTree.get_widget("extensionsmenu").get_submenu()
184 new_menu_item = gtk.MenuItem(menu_item_name)185 if isinstance(menu_item_name, gtk.MenuItem):
186 new_menu_item = menu_item_name
187 else:
188 new_menu_item = gtk.MenuItem(menu_item_name)
189
185 new_menu_item.connect("activate", callback_function)190 new_menu_item.connect("activate", callback_function)
186 extensions_menu.prepend(new_menu_item)191 extensions_menu.prepend(new_menu_item)
187 new_menu_item.show()192 new_menu_item.show()
188193
=== modified file 'Jokosher/PlatformUtils/Unix.py'
--- Jokosher/PlatformUtils/Unix.py 2009-03-19 23:39:14 +0000
+++ Jokosher/PlatformUtils/Unix.py 2010-01-26 05:33:14 +0000
@@ -23,6 +23,13 @@
23 return urllib.url2pathname(url)23 return urllib.url2pathname(url)
2424
25def pathname2url(path):25def pathname2url(path):
26 # urllib.pathname2url uses urllib.quote(), which cannot handle unicode.
27 # See http://bugs.python.org/issue1712522 for details.
28 # Basically its fixed in Python 3.0+ because all strings are utf8
29 # and a safe assumption can be made. But here in Python 2.x urllib.quote()
30 # expects *bytes* so we have to convert it explicitly.
31 path = path.encode('utf8')
32
26 return "file://%s" % urllib.pathname2url(path)33 return "file://%s" % urllib.pathname2url(path)
2734
28def GetRecordingDefaults():35def GetRecordingDefaults():
2936
=== modified file 'Jokosher/ui/StatusBar.py'
--- Jokosher/ui/StatusBar.py 2009-11-14 17:58:08 +0000
+++ Jokosher/ui/StatusBar.py 2010-01-26 05:33:14 +0000
@@ -10,6 +10,7 @@
10#-------------------------------------------------------------------------------10#-------------------------------------------------------------------------------
1111
12import gtk12import gtk
13import pango
1314
14#=========================================================================15#=========================================================================
1516
@@ -24,9 +25,32 @@
24 Creates a new instance of StatusBar with no messages shown.25 Creates a new instance of StatusBar with no messages shown.
25 """26 """
26 gtk.Statusbar.__init__(self)27 gtk.Statusbar.__init__(self)
27 # gtk.Statusbar contains a label inside a frame inside itself28 # gtk.Statusbar contains a label somewhere inside itself
28 self.label = self.get_children()[0].get_children()[0]29 self.label = self.get_label_in_hierarchy()
29 self.label.set_use_markup(True)30 if self.label:
31 self.label.set_use_markup(True)
32
33 #_____________________________________________________________________
34
35 def get_label_in_hierarchy(self):
36 """
37 In Gtk+ 2.19 Statusbar was changed to keep a the Label inside an
38 HBox inside a frame. In previous versions the Label was directly
39 inside the frame.
40
41 Here we search the entire container hierarchy and hope it will
42 continue to work even if another container is added in the
43 future.
44 """
45 unchecked = [self]
46 while unchecked:
47 widget = unchecked.pop(0)
48 if isinstance(widget, gtk.Label):
49 return widget
50 elif isinstance(widget, gtk.Container):
51 unchecked.extend(widget.get_children())
52
53 return None
30 54
31 #_____________________________________________________________________55 #_____________________________________________________________________
3256
@@ -40,8 +64,13 @@
40 Return:64 Return:
41 the value of the next valid message ID.65 the value of the next valid message ID.
42 """66 """
67 if not self.label:
68 pango_attr_list, text_without_markup, accel_char = pango.parse_markup(message)
69 message = text_without_markup
70
43 message_id = self.push(0, message)71 message_id = self.push(0, message)
44 self.label.set_use_markup(True)72 if self.label:
73 self.label.set_use_markup(True)
45 return message_id74 return message_id
46 75
47 #_____________________________________________________________________76 #_____________________________________________________________________
@@ -54,7 +83,8 @@
54 message_id -- numerical id of the message to be removed from the StatusBar.83 message_id -- numerical id of the message to be removed from the StatusBar.
55 """84 """
56 self.remove_message(0, message_id)85 self.remove_message(0, message_id)
57 self.label.set_use_markup(True)86 if self.label:
87 self.label.set_use_markup(True)
58 88
59 #_____________________________________________________________________89 #_____________________________________________________________________
6090
6191
=== added file 'extensions/Fullscreen.py'
--- extensions/Fullscreen.py 1970-01-01 00:00:00 +0000
+++ extensions/Fullscreen.py 2010-01-26 05:33:14 +0000
@@ -0,0 +1,22 @@
1import Jokosher.Extension
2import gtk
3
4EXTENSION_NAME = "Fullscreen"
5EXTENSION_DESCRIPTION = "Make the Jokosher window fullscreen"
6EXTENSION_VERSION = "1"
7
8API = None
9
10def do_fullscreen(menu_item):
11 if menu_item.get_active():
12 API.jokosher.window.fullscreen()
13 else:
14 API.jokosher.window.unfullscreen()
15
16def startup(api):
17 global API
18 API = api
19 api.add_menu_item(gtk.CheckMenuItem("View fullscreen"), do_fullscreen)
20
21def shutdown():
22 pass

Subscribers

People subscribed via source and target branches