diff options
Diffstat (limited to 'PortfolioActivity.py')
-rw-r--r-- | PortfolioActivity.py | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/PortfolioActivity.py b/PortfolioActivity.py index 80d3295..670751d 100644 --- a/PortfolioActivity.py +++ b/PortfolioActivity.py @@ -204,42 +204,42 @@ class PortfolioActivity(activity.Activity): def _set_xy_wh(self): orientation = self._orientation - self._title_wh = [TITLE[orientation][2] * self._scale, - TITLE[orientation][3] * self._scale] - self._title_xy = [TITLE[orientation][0] * self._scale, - TITLE[orientation][1] * self._scale] + self._title_wh = [int(TITLE[orientation][2] * self._scale), + int(TITLE[orientation][3] * self._scale)] + self._title_xy = [int(TITLE[orientation][0] * self._scale), + int(TITLE[orientation][1] * self._scale)] self._title_xy[0] = int((self._width - self._title_wh[0]) / 2.) - self._preview_wh = [PREVIEW[orientation][2] * self._scale, - PREVIEW[orientation][3] * self._scale] - self._preview_xy = [PREVIEW[orientation][0] * self._scale, - PREVIEW[orientation][1] * self._scale] + self._preview_wh = [int(PREVIEW[orientation][2] * self._scale), + int(PREVIEW[orientation][3] * self._scale)] + self._preview_xy = [int(PREVIEW[orientation][0] * self._scale), + int(PREVIEW[orientation][1] * self._scale)] if orientation == 0: self._preview_xy[0] = self._title_xy[0] else: self._preview_xy[0] = int((self._width - self._preview_wh[0]) / 2.) - self._desc_wh = [DESC[orientation][2] * self._scale, - DESC[orientation][3] * self._scale] + self._desc_wh = [int(DESC[orientation][2] * self._scale), + int(DESC[orientation][3] * self._scale)] if orientation == 0: self._desc_wh[0] = \ self._width - self._preview_wh[0] - 2 * self._title_xy[0] else: self._desc_wh[0] = self._title_wh[0] - self._desc_xy = [DESC[orientation][0] * self._scale, - DESC[orientation][1] * self._scale] + self._desc_xy = [int(DESC[orientation][0] * self._scale), + int(DESC[orientation][1] * self._scale)] if orientation == 0: self._desc_xy[0] = self._preview_wh[0] + self._title_xy[0] else: self._desc_xy[0] = self._title_xy[0] - self._new_comment_wh = [NEW_COMMENT[orientation][2] * self._scale, - NEW_COMMENT[orientation][3] * self._scale] - self._new_comment_xy = [NEW_COMMENT[orientation][0] * self._scale, - NEW_COMMENT[orientation][1] * self._scale] + self._new_comment_wh = [int(NEW_COMMENT[orientation][2] * self._scale), + int(NEW_COMMENT[orientation][3] * self._scale)] + self._new_comment_xy = [int(NEW_COMMENT[orientation][0] * self._scale), + int(NEW_COMMENT[orientation][1] * self._scale)] self._new_comment_xy[0] = self._title_xy[0] self._new_comment_xy[1] = self._desc_xy[1] + self._desc_wh[1] - self._comment_wh = [COMMENTS[orientation][2] * self._scale, - COMMENTS[orientation][3] * self._scale] - self._comment_xy = [COMMENTS[orientation][0] * self._scale, - COMMENTS[orientation][1] * self._scale] + self._comment_wh = [int(COMMENTS[orientation][2] * self._scale), + int(COMMENTS[orientation][3] * self._scale)] + self._comment_xy = [int(COMMENTS[orientation][0] * self._scale), + int(COMMENTS[orientation][1] * self._scale)] self._comment_xy[0] = self._title_xy[0] self._comment_xy[1] = self._new_comment_xy[1] + self._new_comment_wh[1] @@ -289,13 +289,13 @@ class PortfolioActivity(activity.Activity): self._canvas.add_events(gtk.gdk.BUTTON_PRESS_MASK) self._canvas.add_events(gtk.gdk.POINTER_MOTION_MASK) self._canvas.add_events(gtk.gdk.BUTTON_RELEASE_MASK) - self._canvas.add_events(gtk.gdk.KEY_PRESS_MASK) + # self._canvas.add_events(gtk.gdk.KEY_PRESS_MASK) self._canvas.add_events(gtk.gdk.CONFIGURE) self._canvas.connect('expose-event', self._expose_cb) self._canvas.connect('button-press-event', self._button_press_cb) self._canvas.connect('button-release-event', self._button_release_cb) self._canvas.connect('motion-notify-event', self._mouse_move_cb) - self._canvas.connect('key-press-event', self._keypress_cb) + # self._canvas.connect('key-press-event', self._keypress_cb) gtk.gdk.screen_get_default().connect('size-changed', self._configure_cb) self._canvas.grab_focus() @@ -1052,7 +1052,7 @@ class PortfolioActivity(activity.Activity): self._selected_spr.set_label(label) if not hasattr(self, 'desc_entry'): self.desc_entry = gtk.TextView() - # self.desc_entry.set_wrap_mode(Gtk.WrapMode.WORD) + self.desc_entry.set_wrap_mode(gtk.WRAP_WORD) self.desc_entry.set_pixels_above_lines(0) self.desc_entry.set_size_request(self._desc_wh[0], self._desc_wh[1]) @@ -1062,9 +1062,10 @@ class PortfolioActivity(activity.Activity): rgba.alpha = 1. self.desc_entry.override_background_color( gtk.StateFlags.NORMAL, rgba) - ''' font_desc = pango.font_description_from_string( str(self.desc_size)) + ''' + font_desc = pango.FontDescription(str(self.desc_size)) self.desc_entry.modify_font(font_desc) self.fixed.put(self.desc_entry, 0, 0) self.text_entry = self.desc_entry @@ -1079,6 +1080,7 @@ class PortfolioActivity(activity.Activity): return True if not hasattr(self, 'title_entry'): self.title_entry = gtk.TextView() + self.title_entry.set_wrap_mode(gtk.WRAP_WORD) self.title_entry.set_justification(gtk.JUSTIFY_CENTER) self.title_entry.set_pixels_above_lines(1) ''' @@ -1087,9 +1089,10 @@ class PortfolioActivity(activity.Activity): rgba.alpha = 1. self.title_entry.override_background_color( Gtk.StateFlags.NORMAL, rgba) - ''' font_desc = pango.font_description_from_string( str(self.title_size)) + ''' + font_desc = pango.FontDescription(str(self.title_size)) self.title_entry.modify_font(font_desc) self.fixed.put(self.title_entry, 0, 0) self.text_entry = self.title_entry @@ -1101,7 +1104,7 @@ class PortfolioActivity(activity.Activity): self._saved_string = spr.labels[0] if not hasattr(self, 'comment_entry'): self.comment_entry = gtk.TextView() - # self.comment_entry.set_wrap_mode(Gtk.WrapMode.WORD) + self.comment_entry.set_wrap_mode(gtk.WRAP_WORD) self.comment_entry.set_pixels_above_lines(0) self.comment_entry.set_size_request( self._new_comment_wh[0], self._new_comment_wh[1]) @@ -1111,9 +1114,10 @@ class PortfolioActivity(activity.Activity): rgba.alpha = 1. self.comment_entry.override_background_color( Gtk.StateFlags.NORMAL, rgba) - ''' font_desc = pango.font_description_from_string( str(self.desc_size)) + ''' + font_desc = pango.FontDescription(str(self.desc_size)) self.comment_entry.modify_font(font_desc) self.fixed.put(self.comment_entry, 0, 0) self.text_entry = self.comment_entry @@ -1435,8 +1439,8 @@ class PortfolioActivity(activity.Activity): self.add_alert(self._alert) self._alert.show() + ''' def _keypress_cb(self, area, event): - ''' Keyboard ''' keyname = Gdk.keyval_name(event.keyval) keyunicode = Gdk.keyval_to_unicode(event.keyval) if event.get_state() & Gdk.ModifierType.MOD1_MASK: @@ -1465,6 +1469,7 @@ class PortfolioActivity(activity.Activity): elif keyname == 'End': self._last_cb() return True + ''' def _unselect(self): if hasattr(self, 'text_entry'): |