Changeset 994:e71fbf2ee978 for src
- Timestamp:
- 07/04/19 17:29:58 (5 years ago)
- Branch:
- python3
- Phase:
- public
- Location:
- src/mlx
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/common.py
r955 r994 7 7 # Common definitions to be used by both the GUI and possible other parts 8 8 # 9 # The main purpose of this module is to import Gtk+2 or 3 and related modules10 # and provide common names for them. There is a similator module in the GUI11 # part (\ref mlx.gui.common), which contains the GUI-specific names. This one12 # contains only what is used by other modules as well.13 # The variable \c pygobject tells which version of Gtk is being used. If it is14 # \c True, Gtk+ 3 is used via the PyGObject interface. Otherwise Gtk+ 2 is15 # used, which is the default on Windows or when the \c FORCE_PYGTK environment16 # variable is set.17 18 9 #--------------------------------------------------------------------------------------- 19 10 … … 22 13 #------------------------------------------------------------------------------- 23 14 24 if "FORCE_PYGTK" in os.environ: 25 print("Using PyGTK") 26 pygobject = False 27 import gobject 28 else: 29 print("Using PyGObject") 30 pygobject = True 31 32 from gi.repository import GObject as gobject 15 from gi.repository import GObject as gobject 33 16 34 17 #------------------------------------------------------------------------------- -
src/mlx/gui/callouts.py
r919 r994 477 477 478 478 menu = self._fileListPopupMenu 479 if pygobject: 480 menu.popup(None, None, None, None, event.button, event.time) 481 else: 482 menu.popup(None, None, None, event.button, event.time) 479 menu.popup(None, None, None, None, event.button, event.time) 483 480 484 481 def _buildFileListPopupMenu(self): -
src/mlx/gui/checklist.py
r954 r994 243 243 selection = self._fileList.get_selection() 244 244 (model, paths) = selection.get_selected_rows() 245 indexes = [(path.get_indices() if pygobject else path)[0] 246 for path in paths] 245 indexes = [path.get_indices()[0] for path in paths] 247 246 indexes.sort() 248 247 if not up: … … 273 272 maxIndex = None 274 273 for path in paths: 275 [index] = path.get_indices() if pygobject else path274 [index] = path.get_indices() 276 275 if minIndex is None or index<minIndex: minIndex = index 277 276 if maxIndex is None or index>maxIndex: maxIndex = index … … 326 325 327 326 menu = self._fileListPopupMenu 328 if pygobject: 329 menu.popup(None, None, None, None, event.button, event.time) 330 else: 331 menu.popup(None, None, None, event.button, event.time) 327 menu.popup(None, None, None, None, event.button, event.time) 332 328 333 329 def _buildFileListPopupMenu(self): -
src/mlx/gui/common.py
r954 r994 16 16 # 17 17 # Common definitions and utilities for the GUI 18 #19 # The main purpose of this module is to provide common definitions for things20 # that are named differently in Gtk+ 2 and 3. This way the other parts of the21 # GUI have to check the version in use very rarely. The variable \c pygobject22 # tells which version is being used. If it is \c True, Gtk+ 3 is used via the23 # PyGObject interface. Otherwise Gtk+ 2 is used, which is the default on24 # Windows or when the \c FORCE_PYGTK environment variable is set.25 #26 # Besides this there are some common utility classes and functions.27 18 28 19 #----------------------------------------------------------------------------- … … 30 21 appIndicator = False 31 22 32 if not pygobject: 33 print("Using PyGTK") 34 pygobject = False 35 import pygtk 36 pygtk.require("2.0") 37 import gtk.gdk as gdk 38 import gtk 39 import pango 40 41 try: 42 import appindicator 43 appIndicator = True 44 except Exception as e: 45 pass 46 47 MESSAGETYPE_ERROR = gtk.MESSAGE_ERROR 48 MESSAGETYPE_QUESTION = gtk.MESSAGE_QUESTION 49 MESSAGETYPE_INFO = gtk.MESSAGE_INFO 50 51 RESPONSETYPE_NONE = gtk.RESPONSE_NONE 52 RESPONSETYPE_OK = gtk.RESPONSE_OK 53 RESPONSETYPE_YES = gtk.RESPONSE_YES 54 RESPONSETYPE_NO = gtk.RESPONSE_NO 55 RESPONSETYPE_ACCEPT = gtk.RESPONSE_ACCEPT 56 RESPONSETYPE_REJECT = gtk.RESPONSE_REJECT 57 RESPONSETYPE_CANCEL = gtk.RESPONSE_CANCEL 58 59 ACCEL_VISIBLE = gtk.ACCEL_VISIBLE 60 CONTROL_MASK = gdk.CONTROL_MASK 61 DIALOG_MODAL = gtk.DIALOG_MODAL 62 WRAP_WORD = gtk.WRAP_WORD 63 64 JUSTIFY_CENTER = gtk.JUSTIFY_CENTER 65 JUSTIFY_LEFT = gtk.JUSTIFY_LEFT 66 67 CONTROL_MASK = gdk.CONTROL_MASK 68 SHIFT_MASK = gdk.SHIFT_MASK 69 BUTTON1_MASK = gdk.BUTTON1_MASK 70 71 SCROLL_UP = gdk.SCROLL_UP 72 SCROLL_DOWN = gdk.SCROLL_DOWN 73 74 SPIN_USER_DEFINED = gtk.SPIN_USER_DEFINED 75 76 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER 77 FILE_CHOOSER_ACTION_OPEN = gtk.FILE_CHOOSER_ACTION_OPEN 78 FILE_CHOOSER_ACTION_SAVE = gtk.FILE_CHOOSER_ACTION_SAVE 79 80 SELECTION_MULTIPLE = gtk.SELECTION_MULTIPLE 81 82 SHADOW_IN = gtk.SHADOW_IN 83 SHADOW_NONE = gtk.SHADOW_NONE 84 85 POLICY_AUTOMATIC = gtk.POLICY_AUTOMATIC 86 POLICY_NEVER = gtk.POLICY_NEVER 87 POLICY_ALWAYS = gtk.POLICY_ALWAYS 88 89 WEIGHT_NORMAL = pango.WEIGHT_NORMAL 90 WEIGHT_BOLD = pango.WEIGHT_BOLD 91 92 WINDOW_STATE_ICONIFIED = gdk.WINDOW_STATE_ICONIFIED 93 WINDOW_STATE_WITHDRAWN = gdk.WINDOW_STATE_WITHDRAWN 94 95 SORT_ASCENDING = gtk.SORT_ASCENDING 96 SORT_DESCENDING = gtk.SORT_DESCENDING 97 98 EVENT_BUTTON_PRESS = gdk.BUTTON_PRESS 99 100 TREE_VIEW_COLUMN_FIXED = gtk.TREE_VIEW_COLUMN_FIXED 101 102 FILL = gtk.FILL 103 EXPAND = gtk.EXPAND 104 105 UPDATE_IF_VALID = gtk.UPDATE_IF_VALID 106 107 SELECTION_MULTIPLE = gtk.SELECTION_MULTIPLE 108 109 WINDOW_POPUP = gtk.WINDOW_POPUP 110 111 pixbuf_new_from_file = gdk.pixbuf_new_from_file 112 113 else: # pygobject 114 import gi 115 gi.require_version("Gdk", "3.0") 116 from gi.repository import Gdk as gdk 117 from gi.repository import GdkPixbuf as gdkPixbuf 118 gi.require_version("Gtk", "3.0") 119 from gi.repository import Gtk as gtk 120 try: 121 gi.require_version("AppIndicator3", "0.1") 122 from gi.repository import AppIndicator3 as appindicator 123 appIndicator = True 124 except: 125 pass 126 from gi.repository import Pango as pango 127 128 129 130 MESSAGETYPE_ERROR = gtk.MessageType.ERROR 131 MESSAGETYPE_QUESTION = gtk.MessageType.QUESTION 132 MESSAGETYPE_INFO = gtk.MessageType.INFO 133 RESPONSETYPE_NONE = gtk.ResponseType.NONE 134 RESPONSETYPE_OK = gtk.ResponseType.OK 135 RESPONSETYPE_YES = gtk.ResponseType.YES 136 RESPONSETYPE_NO = gtk.ResponseType.NO 137 RESPONSETYPE_ACCEPT = gtk.ResponseType.ACCEPT 138 RESPONSETYPE_REJECT = gtk.ResponseType.REJECT 139 RESPONSETYPE_CANCEL = gtk.ResponseType.CANCEL 140 ACCEL_VISIBLE = gtk.AccelFlags.VISIBLE 141 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK 142 DIALOG_MODAL = gtk.DialogFlags.MODAL 143 WRAP_WORD = gtk.WrapMode.WORD 144 JUSTIFY_CENTER = gtk.Justification.CENTER 145 JUSTIFY_LEFT = gtk.Justification.LEFT 146 147 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK 148 SHIFT_MASK = gdk.ModifierType.SHIFT_MASK 149 BUTTON1_MASK = gdk.ModifierType.BUTTON1_MASK 150 151 SCROLL_UP = gdk.ScrollDirection.UP 152 SCROLL_DOWN = gdk.ScrollDirection.DOWN 153 154 SPIN_USER_DEFINED = gtk.SpinType.USER_DEFINED 155 156 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FileChooserAction.SELECT_FOLDER 157 FILE_CHOOSER_ACTION_OPEN = gtk.FileChooserAction.OPEN 158 FILE_CHOOSER_ACTION_SAVE = gtk.FileChooserAction.SAVE 159 160 SELECTION_MULTIPLE = gtk.SelectionMode.MULTIPLE 161 162 SHADOW_IN = gtk.ShadowType.IN 163 SHADOW_NONE = gtk.ShadowType.NONE 164 165 POLICY_AUTOMATIC = gtk.PolicyType.AUTOMATIC 166 POLICY_NEVER = gtk.PolicyType.NEVER 167 POLICY_ALWAYS = gtk.PolicyType.ALWAYS 168 169 WEIGHT_NORMAL = pango.Weight.NORMAL 170 WEIGHT_BOLD = pango.Weight.BOLD 171 172 WINDOW_STATE_ICONIFIED = gdk.WindowState.ICONIFIED 173 WINDOW_STATE_WITHDRAWN = gdk.WindowState.WITHDRAWN 174 175 SORT_ASCENDING = gtk.SortType.ASCENDING 176 SORT_DESCENDING = gtk.SortType.DESCENDING 177 178 EVENT_BUTTON_PRESS = gdk.EventType.BUTTON_PRESS 179 180 TREE_VIEW_COLUMN_FIXED = gtk.TreeViewColumnSizing.FIXED 181 182 FILL = gtk.AttachOptions.FILL 183 EXPAND = gtk.AttachOptions.EXPAND 184 185 UPDATE_IF_VALID = gtk.SpinButtonUpdatePolicy.IF_VALID 186 187 SELECTION_MULTIPLE = gtk.SelectionMode.MULTIPLE 188 189 pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file 190 191 import codecs 192 _utf8Decoder = codecs.getdecoder("utf-8") 23 import gi 24 gi.require_version("Gdk", "3.0") 25 from gi.repository import Gdk as gdk 26 from gi.repository import GdkPixbuf as gdkPixbuf 27 gi.require_version("Gtk", "3.0") 28 from gi.repository import Gtk as gtk 29 try: 30 gi.require_version("AppIndicator3", "0.1") 31 from gi.repository import AppIndicator3 as appindicator 32 appIndicator = True 33 except: 34 pass 35 from gi.repository import Pango as pango 36 37 38 MESSAGETYPE_ERROR = gtk.MessageType.ERROR 39 MESSAGETYPE_QUESTION = gtk.MessageType.QUESTION 40 MESSAGETYPE_INFO = gtk.MessageType.INFO 41 RESPONSETYPE_NONE = gtk.ResponseType.NONE 42 RESPONSETYPE_OK = gtk.ResponseType.OK 43 RESPONSETYPE_YES = gtk.ResponseType.YES 44 RESPONSETYPE_NO = gtk.ResponseType.NO 45 RESPONSETYPE_ACCEPT = gtk.ResponseType.ACCEPT 46 RESPONSETYPE_REJECT = gtk.ResponseType.REJECT 47 RESPONSETYPE_CANCEL = gtk.ResponseType.CANCEL 48 ACCEL_VISIBLE = gtk.AccelFlags.VISIBLE 49 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK 50 DIALOG_MODAL = gtk.DialogFlags.MODAL 51 WRAP_WORD = gtk.WrapMode.WORD 52 JUSTIFY_CENTER = gtk.Justification.CENTER 53 JUSTIFY_LEFT = gtk.Justification.LEFT 54 55 CONTROL_MASK = gdk.ModifierType.CONTROL_MASK 56 SHIFT_MASK = gdk.ModifierType.SHIFT_MASK 57 BUTTON1_MASK = gdk.ModifierType.BUTTON1_MASK 58 59 SCROLL_UP = gdk.ScrollDirection.UP 60 SCROLL_DOWN = gdk.ScrollDirection.DOWN 61 62 SPIN_USER_DEFINED = gtk.SpinType.USER_DEFINED 63 64 FILE_CHOOSER_ACTION_SELECT_FOLDER = gtk.FileChooserAction.SELECT_FOLDER 65 FILE_CHOOSER_ACTION_OPEN = gtk.FileChooserAction.OPEN 66 FILE_CHOOSER_ACTION_SAVE = gtk.FileChooserAction.SAVE 67 68 SELECTION_MULTIPLE = gtk.SelectionMode.MULTIPLE 69 70 SHADOW_IN = gtk.ShadowType.IN 71 SHADOW_NONE = gtk.ShadowType.NONE 72 73 POLICY_AUTOMATIC = gtk.PolicyType.AUTOMATIC 74 POLICY_NEVER = gtk.PolicyType.NEVER 75 POLICY_ALWAYS = gtk.PolicyType.ALWAYS 76 77 WEIGHT_NORMAL = pango.Weight.NORMAL 78 WEIGHT_BOLD = pango.Weight.BOLD 79 80 WINDOW_STATE_ICONIFIED = gdk.WindowState.ICONIFIED 81 WINDOW_STATE_WITHDRAWN = gdk.WindowState.WITHDRAWN 82 83 SORT_ASCENDING = gtk.SortType.ASCENDING 84 SORT_DESCENDING = gtk.SortType.DESCENDING 85 86 EVENT_BUTTON_PRESS = gdk.EventType.BUTTON_PRESS 87 88 TREE_VIEW_COLUMN_FIXED = gtk.TreeViewColumnSizing.FIXED 89 90 FILL = gtk.AttachOptions.FILL 91 EXPAND = gtk.AttachOptions.EXPAND 92 93 UPDATE_IF_VALID = gtk.SpinButtonUpdatePolicy.IF_VALID 94 95 SELECTION_MULTIPLE = gtk.SelectionMode.MULTIPLE 96 97 pixbuf_new_from_file = gdkPixbuf.Pixbuf.new_from_file 98 99 import codecs 100 _utf8Decoder = codecs.getdecoder("utf-8") 193 101 194 102 import cairo -
src/mlx/gui/delaycodes.py
r965 r994 11 11 #------------------------------------------------------------------------------ 12 12 13 if pygobject: 14 15 #------------------------------------------------------------------------------ 16 17 class Viewport(gtk.Viewport): 18 """Viewport implementation that alleviates the problem with improper 19 resizing by the VBox.""" 20 def __init__(self): 21 """Construct the viewport.""" 22 gtk.Viewport.__init__(self) 23 self._recursive = False 13 class Viewport(gtk.Viewport): 14 """Viewport implementation that alleviates the problem with improper 15 resizing by the VBox.""" 16 def __init__(self): 17 """Construct the viewport.""" 18 gtk.Viewport.__init__(self) 19 self._recursive = False 20 self._vboxHeight = None 21 22 def setVBOXHeight(self, vboxHeight): 23 """Set the height of the VBox which will be used to calculate the 24 viewport's height.""" 25 self._vboxHeight = vboxHeight 26 27 def do_size_allocate(self, allocation): 28 """Called when the viewport's size is allocated. 29 30 The height in the allocation object is modified so that it is only 31 so high to fit into the VBox.""" 32 if self._vboxHeight is not None: 33 allocation.y += 1 34 allocation.height = self._vboxHeight - allocation.y 24 35 self._vboxHeight = None 25 26 def setVBOXHeight(self, vboxHeight): 27 """Set the height of the VBox which will be used to calculate the 28 viewport's height.""" 29 self._vboxHeight = vboxHeight 30 31 def do_size_allocate(self, allocation): 32 """Called when the viewport's size is allocated. 33 34 The height in the allocation object is modified so that it is only 35 so high to fit into the VBox.""" 36 if self._vboxHeight is not None: 37 allocation.y += 1 38 allocation.height = self._vboxHeight - allocation.y 39 self._vboxHeight = None 40 gtk.Viewport.do_size_allocate(self, allocation) 41 42 class DelayCodeTableBase(gtk.VBox, gtk.Scrollable): 43 """PyGObject-specific base class for the delay code table.""" 44 __gproperties__ = { 45 "vscroll-policy" : ( gtk.ScrollablePolicy, 46 "vscroll-policy", 47 "The vertical scrolling policy", 48 gtk.ScrollablePolicy.MINIMUM, 49 gobject.PARAM_READWRITE ), 50 "vadjustment" : ( gtk.Adjustment, 51 "vadjustment", 52 "The vertical adjustment", 53 gobject.PARAM_READWRITE ), 54 "hscroll-policy" : ( gtk.ScrollablePolicy, 55 "hscroll-policy", 56 "The horizontal scrolling policy", 57 gtk.ScrollablePolicy.MINIMUM, 58 gobject.PARAM_READWRITE ), 59 "hadjustment" : ( gtk.Adjustment, 60 "hadjustment", 61 "The horizontal adjustment", 62 gobject.PARAM_READWRITE ) } 63 64 65 @staticmethod 66 def _createViewport(): 67 """Create an instance of the viewport class used by this base class.""" 68 return Viewport() 69 70 def __init__(self): 71 """Construct the delay code table.""" 72 super(DelayCodeTableBase, self).__init__() 73 74 def do_size_allocate(self, allocation): 75 """Allocate the size for the table and its children. 76 77 This sets up the VBox height in the viewport and then calls the 78 do_size_allocate() function of VBox().""" 79 self._viewport.setVBOXHeight(allocation.height) 80 gtk.VBox.do_size_allocate(self, allocation) 81 self.allocate_column_sizes(allocation) 82 83 def do_get_property(self, prop): 84 """Get the value of one of the properties defined above. 85 86 The request is forwarded to the viewport.""" 87 if prop.name=="vscroll-policy": 88 return self._viewport.get_vscroll_policy() 89 elif prop.name=="hscroll-policy": 90 return self._viewport.get_hscroll_policy() 91 elif prop.name=="vadjustment": 92 return self._viewport.get_vadjustment() 93 elif prop.name=="hadjustment": 94 return self._viewport.get_hadjustment() 95 else: 96 raise AttributeError("mlx.gui.delaycodes.DelayCodeTableBase: property %s is not handled in do_get_property" % 97 (prop.name,)) 98 99 def do_set_property(self, prop, value): 100 """Set the value of the adjustment properties defined above. 101 102 The adjustments are forwarded to the viewport.""" 103 if prop.name=="vadjustment": 104 self._viewport.set_vadjustment(value) 105 elif prop.name=="hadjustment": 106 self._viewport.set_hadjustment(value) 107 self._treeView.set_hadjustment(value) 108 else: 109 raise AttributeError("mlx.gui.delaycodes.DelayCodeTableBase: property %s is not handled in do_set_property" % 110 (prop.name,)) 111 112 def setStyle(self): 113 """Set the style of the event box from the treeview.""" 114 115 class Alignment(gtk.Alignment): 116 """An alignment that remembers the width it was given.""" 117 def __init__(self, xalign = 0.0, yalign=0.0, 118 xscale = 0.0, yscale = 0.0 ): 119 """Construct the alignment.""" 120 super(Alignment, self).__init__(xalign = xalign, yalign = yalign, 121 xscale = xscale, yscale = yscale) 122 self.allocatedWidth = 0 123 124 def do_size_allocate(self, allocation): 125 """Called with the new size allocation.""" 126 self.allocatedWidth = allocation.width 127 gtk.Alignment.do_size_allocate(self, allocation) 128 129 class TreeView(gtk.TreeView): 130 def do_size_allocate(self, allocation): 131 allocation.height += 1 132 gtk.TreeView.do_size_allocate(self, allocation) 133 134 #------------------------------------------------------------------------------ 135 136 else: # pygobject 137 138 #------------------------------------------------------------------------------ 139 140 class DelayCodeTableBase (gtk.VBox): 141 """Base class of the delay code table for PyGtk.""" 142 143 __gsignals__ = { 144 "set-scroll-adjustments": ( 145 gobject.SIGNAL_RUN_LAST, 146 gobject.TYPE_NONE, (gtk.Adjustment, gtk.Adjustment)) 147 } 148 149 @staticmethod 150 def _createViewport(): 151 """Create an instance of the viewport class used by this base class.""" 152 return gtk.Viewport() 153 154 def __init__(self): 155 """Construct the base class.""" 156 super(DelayCodeTableBase, self).__init__() 157 self.set_set_scroll_adjustments_signal("set-scroll-adjustments") 158 self.connect("size-allocate", self._do_size_allocate) 159 160 def do_set_scroll_adjustments(self, hAdjustment, vAdjustment): 161 """Set the adjustments on the viewport.""" 162 self._viewport.set_hadjustment(hAdjustment) 163 self._viewport.set_vadjustment(vAdjustment) 164 self._treeView.set_hadjustment(hAdjustment) 165 166 def _do_size_allocate(self, widget, allocation): 167 """Handler of the size-allocate signal. 168 169 Calls allocate_column_sizes().""" 170 self.allocate_column_sizes(allocation) 171 172 def setStyle(self): 173 """Set the style of the event box from the treeview.""" 174 if self._treeView is not None: 175 style = self._treeView.rc_get_style() 176 self._eventBox.modify_bg(0, style.bg[2]) 177 self._eventBox.modify_fg(0, style.fg[2]) 178 179 class Alignment(gtk.Alignment): 180 """An alignment that remembers the width it was given.""" 181 def __init__(self, xalign = 0.0, yalign=0.0, 182 xscale = 0.0, yscale = 0.0 ): 183 """Construct the alignment.""" 184 super(Alignment, self).__init__(xalign = xalign, yalign = yalign, 185 xscale = xscale, yscale = yscale) 186 self.allocatedWidth = 0 187 self.connect("size-allocate", self._do_size_allocate) 188 189 def _do_size_allocate(self, widget, allocation): 190 """Called with the new size allocation.""" 191 self.allocatedWidth = allocation.width 36 gtk.Viewport.do_size_allocate(self, allocation) 37 38 class DelayCodeTableBase(gtk.VBox, gtk.Scrollable): 39 """PyGObject-specific base class for the delay code table.""" 40 __gproperties__ = { 41 "vscroll-policy" : ( gtk.ScrollablePolicy, 42 "vscroll-policy", 43 "The vertical scrolling policy", 44 gtk.ScrollablePolicy.MINIMUM, 45 gobject.PARAM_READWRITE ), 46 "vadjustment" : ( gtk.Adjustment, 47 "vadjustment", 48 "The vertical adjustment", 49 gobject.PARAM_READWRITE ), 50 "hscroll-policy" : ( gtk.ScrollablePolicy, 51 "hscroll-policy", 52 "The horizontal scrolling policy", 53 gtk.ScrollablePolicy.MINIMUM, 54 gobject.PARAM_READWRITE ), 55 "hadjustment" : ( gtk.Adjustment, 56 "hadjustment", 57 "The horizontal adjustment", 58 gobject.PARAM_READWRITE ) } 59 60 61 @staticmethod 62 def _createViewport(): 63 """Create an instance of the viewport class used by this base class.""" 64 return Viewport() 65 66 def __init__(self): 67 """Construct the delay code table.""" 68 super(DelayCodeTableBase, self).__init__() 69 70 def do_size_allocate(self, allocation): 71 """Allocate the size for the table and its children. 72 73 This sets up the VBox height in the viewport and then calls the 74 do_size_allocate() function of VBox().""" 75 self._viewport.setVBOXHeight(allocation.height) 76 gtk.VBox.do_size_allocate(self, allocation) 77 self.allocate_column_sizes(allocation) 78 79 def do_get_property(self, prop): 80 """Get the value of one of the properties defined above. 81 82 The request is forwarded to the viewport.""" 83 if prop.name=="vscroll-policy": 84 return self._viewport.get_vscroll_policy() 85 elif prop.name=="hscroll-policy": 86 return self._viewport.get_hscroll_policy() 87 elif prop.name=="vadjustment": 88 return self._viewport.get_vadjustment() 89 elif prop.name=="hadjustment": 90 return self._viewport.get_hadjustment() 91 else: 92 raise AttributeError("mlx.gui.delaycodes.DelayCodeTableBase: property %s is not handled in do_get_property" % 93 (prop.name,)) 94 95 def do_set_property(self, prop, value): 96 """Set the value of the adjustment properties defined above. 97 98 The adjustments are forwarded to the viewport.""" 99 if prop.name=="vadjustment": 100 self._viewport.set_vadjustment(value) 101 elif prop.name=="hadjustment": 102 self._viewport.set_hadjustment(value) 103 self._treeView.set_hadjustment(value) 104 else: 105 raise AttributeError("mlx.gui.delaycodes.DelayCodeTableBase: property %s is not handled in do_set_property" % 106 (prop.name,)) 107 108 def setStyle(self): 109 """Set the style of the event box from the treeview.""" 110 111 class Alignment(gtk.Alignment): 112 """An alignment that remembers the width it was given.""" 113 def __init__(self, xalign = 0.0, yalign=0.0, 114 xscale = 0.0, yscale = 0.0 ): 115 """Construct the alignment.""" 116 super(Alignment, self).__init__(xalign = xalign, yalign = yalign, 117 xscale = xscale, yscale = yscale) 118 self.allocatedWidth = 0 119 120 def do_size_allocate(self, allocation): 121 """Called with the new size allocation.""" 122 self.allocatedWidth = allocation.width 123 gtk.Alignment.do_size_allocate(self, allocation) 124 125 class TreeView(gtk.TreeView): 126 def do_size_allocate(self, allocation): 127 allocation.height += 1 128 gtk.TreeView.do_size_allocate(self, allocation) 192 129 193 130 #------------------------------------------------------------------------------ -
src/mlx/gui/faultexplain.py
r988 r994 59 59 self.show_all() 60 60 61 if pygobject: 62 styleContext = self.get_style_context() 63 color = styleContext.get_background_color(gtk.StateFlags.NORMAL) 64 fault.override_background_color(0, color) 65 else: 66 style = self.rc_get_style() 67 fault.modify_base(0, style.bg[0]) 61 styleContext = self.get_style_context() 62 color = styleContext.get_background_color(gtk.StateFlags.NORMAL) 63 fault.override_background_color(0, color) 68 64 69 65 self._hasExplanation = False … … 285 281 not.""" 286 282 allExplained = self._numExplanations >= self._numFaults 287 if pygobject: 288 styleContext = self.get_style_context() 289 if allExplained: 290 outerColour = innerColour = gdk.RGBA(red = 0.0, green=0.0, 291 blue=0.0, alpha=0.0) 292 else: 293 outerColour = \ 294 styleContext.get_border_color(gtk.StateFlags.DROP_ACTIVE) 295 innerColour = self._gui.backgroundColour 296 297 self._outerBox.override_background_color(gtk.StateFlags.NORMAL, 298 outerColour) 299 self._innerBox.override_background_color(gtk.StateFlags.NORMAL, 300 innerColour) 283 styleContext = self.get_style_context() 284 if allExplained: 285 outerColour = innerColour = gdk.RGBA(red = 0.0, green=0.0, 286 blue=0.0, alpha=0.0) 301 287 else: 302 style = self.rc_get_style() 303 self._outerBox.modify_bg(0, style.bg[0 if allExplained else 3]) 288 outerColour = \ 289 styleContext.get_border_color(gtk.StateFlags.DROP_ACTIVE) 290 innerColour = self._gui.backgroundColour 291 292 self._outerBox.override_background_color(gtk.StateFlags.NORMAL, 293 outerColour) 294 self._innerBox.override_background_color(gtk.StateFlags.NORMAL, 295 innerColour) 304 296 305 297 #------------------------------------------------------------------------------- -
src/mlx/gui/flight.py
r992 r994 121 121 self._helpLabel = gtk.Label(longerHelp) 122 122 # FIXME: should be a constant in common 123 self._helpLabel.set_justify(gtk.Justification.CENTER if pygobject 124 else gtk.JUSTIFY_CENTER) 123 self._helpLabel.set_justify(gtk.Justification.CENTER) 125 124 self._helpLabel.set_use_markup(True) 126 125 alignment.add(self._helpLabel) … … 220 219 def setStyle(self): 221 220 """Set the styles of some of the items on the page.""" 222 if pygobject: 223 context = self.get_style_context() 224 color = context.get_background_color(gtk.StateFlags.SELECTED) 225 self._titleEventBox.modify_bg(0, color.to_color()) 226 color = context.get_color(gtk.StateFlags.SELECTED) 227 self._titleLabel.modify_fg(0, color.to_color()) 228 else: 229 style = self.rc_get_style() 230 self._titleEventBox.modify_bg(0, style.bg[3]) 231 self._titleLabel.modify_fg(0, style.fg[3]) 221 context = self.get_style_context() 222 color = context.get_background_color(gtk.StateFlags.SELECTED) 223 self._titleEventBox.modify_bg(0, color.to_color()) 224 color = context.get_color(gtk.StateFlags.SELECTED) 225 self._titleLabel.modify_fg(0, color.to_color()) 232 226 233 227 def initialize(self): … … 1167 1161 scrolledWindow.add(self._gateList) 1168 1162 scrolledWindow.set_size_request(50, -1) 1169 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 1170 else gtk.POLICY_AUTOMATIC, 1171 gtk.PolicyType.AUTOMATIC if pygobject 1172 else gtk.POLICY_AUTOMATIC) 1173 scrolledWindow.set_shadow_type(gtk.ShadowType.IN if pygobject 1174 else gtk.SHADOW_IN) 1163 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 1164 gtk.PolicyType.AUTOMATIC) 1165 scrolledWindow.set_shadow_type(gtk.ShadowType.IN) 1175 1166 1176 1167 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.0, xscale = 0.0, yscale = 1.0) … … 2012 2003 2013 2004 selectBox = gtk.HBox() 2014 if pygobject: 2015 self._selectMSFS = \ 2016 gtk.RadioButton.new_with_mnemonic_from_widget(None, 2017 xstr("connect_sim_msfs")) 2018 else: 2019 self._selectMSFS = gtk.RadioButton(None, 2020 xstr("connect_sim_msfs")) 2005 self._selectMSFS = \ 2006 gtk.RadioButton.new_with_mnemonic_from_widget(None, 2007 xstr("connect_sim_msfs")) 2021 2008 2022 2009 selectBox.pack_start(self._selectMSFS, False, False, 0); 2023 2010 2024 if pygobject: 2025 self._selectXPlane = \ 2026 gtk.RadioButton.new_with_mnemonic_from_widget(self._selectMSFS, 2027 xstr("connect_sim_xplane")) 2028 else: 2029 self._selectXPlane = gtk.RadioButton(self._selectMSFS, 2030 xstr("connect_sim_xplane")) 2011 self._selectXPlane = \ 2012 gtk.RadioButton.new_with_mnemonic_from_widget(self._selectMSFS, 2013 xstr("connect_sim_xplane")) 2031 2014 2032 2015 selectBox.pack_start(self._selectXPlane, False, False, 8); … … 2510 2493 routeWindow = gtk.ScrolledWindow() 2511 2494 routeWindow.set_size_request(400, 80) 2512 routeWindow.set_shadow_type(gtk.ShadowType.IN if pygobject 2513 else gtk.SHADOW_IN) 2514 routeWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 2515 else gtk.POLICY_AUTOMATIC, 2516 gtk.PolicyType.AUTOMATIC if pygobject 2517 else gtk.POLICY_AUTOMATIC) 2495 routeWindow.set_shadow_type(gtk.ShadowType.IN) 2496 routeWindow.set_policy(gtk.PolicyType.AUTOMATIC, 2497 gtk.PolicyType.AUTOMATIC) 2518 2498 2519 2499 self._uppercasingRoute = False … … 3267 3247 self._tankFigure.set_tooltip_markup(xstr("fuel_tank_tooltip")) 3268 3248 3269 if pygobject: 3270 self._tankFigure.connect("draw", self._drawTankFigure) 3271 else: 3272 self._tankFigure.connect("expose_event", self._drawTankFigure) 3249 self._tankFigure.connect("draw", self._drawTankFigure) 3273 3250 self._tankFigure.connect("button_press_event", self._buttonPressed) 3274 3251 self._tankFigure.connect("motion_notify_event", self._motionNotify) … … 3324 3301 triangleSize = 5 3325 3302 3326 context = eventOrContext if pygobject else tankFigure.window.cairo_create() 3327 (xOffset, yOffset) = (0, 0) if pygobject \ 3328 else (tankFigure.allocation.x, tankFigure.allocation.y) 3329 3330 width = tankFigure.get_allocated_width() if pygobject \ 3331 else tankFigure.allocation.width 3332 height = tankFigure.get_allocated_height() if pygobject \ 3333 else tankFigure.allocation.height 3303 context = eventOrContext 3304 (xOffset, yOffset) = (0, 0) 3305 3306 width = tankFigure.get_allocated_width() 3307 height = tankFigure.get_allocated_height() 3334 3308 3335 3309 rectangleX0 = triangleSize … … 3645 3619 scrolledWindow.set_size_request(-1, 128) 3646 3620 # FIXME: these constants should be in common 3647 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 3648 else gtk.POLICY_AUTOMATIC, 3649 gtk.PolicyType.AUTOMATIC if pygobject 3650 else gtk.POLICY_AUTOMATIC) 3621 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 3622 gtk.PolicyType.AUTOMATIC) 3651 3623 self._notams = gtk.TextView() 3652 3624 self._notams.set_editable(False) 3653 3625 self._notams.set_accepts_tab(False) 3654 self._notams.set_wrap_mode(gtk.WrapMode.WORD if pygobject else gtk.WRAP_WORD)3626 self._notams.set_wrap_mode(gtk.WrapMode.WORD) 3655 3627 scrolledWindow.add(self._notams) 3656 3628 alignment = gtk.Alignment(xalign = 0.0, yalign = 0.0, … … 3666 3638 scrolledWindow = gtk.ScrolledWindow() 3667 3639 scrolledWindow.set_size_request(-1, 32) 3668 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 3669 else gtk.POLICY_AUTOMATIC, 3670 gtk.PolicyType.AUTOMATIC if pygobject 3671 else gtk.POLICY_AUTOMATIC) 3640 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 3641 gtk.PolicyType.AUTOMATIC) 3672 3642 3673 3643 self._updatingMETAR = False … … 3675 3645 self._metar = gtk.TextView() 3676 3646 self._metar.set_accepts_tab(False) 3677 self._metar.set_wrap_mode(gtk.WrapMode.WORD if pygobject else gtk.WRAP_WORD)3647 self._metar.set_wrap_mode(gtk.WrapMode.WORD) 3678 3648 self._metar.get_buffer().connect("changed", self._metarChanged) 3679 3649 self._metar.get_buffer().connect_after("insert-text", self._metarInserted) … … 3872 3842 table.attach(label, 0, 1, row, row+1) 3873 3843 3874 if pygobject: 3875 self._sid = gtk.ComboBox.new_with_model_and_entry(comboModel) 3876 else: 3877 self._sid = gtk.ComboBoxEntry(comboModel) 3844 self._sid = gtk.ComboBox.new_with_model_and_entry(comboModel) 3878 3845 3879 3846 self._sid.set_entry_text_column(0) … … 4238 4205 self._derateLabel.set_sensitive(True) 4239 4206 4240 if pygobject: 4241 nominal = gtk.RadioButton.\ 4242 new_with_label_from_widget(None, 4243 xstr("takeoff_derate_tupolev_nominal")) 4244 else: 4245 nominal = gtk.RadioButton(None, 4246 xstr("takeoff_derate_tupolev_nominal")) 4207 nominal = gtk.RadioButton.\ 4208 new_with_label_from_widget(None, 4209 xstr("takeoff_derate_tupolev_nominal")) 4247 4210 nominal.set_use_underline(True) 4248 4211 nominal.set_tooltip_text(xstr("takeoff_derate_tupolev_nominal_tooltip")) 4249 4212 nominal.connect("toggled", self._derateChanged) 4250 4213 4251 if pygobject: 4252 takeoff = gtk.RadioButton.\ 4253 new_with_label_from_widget(nominal, 4254 xstr("takeoff_derate_tupolev_takeoff")) 4255 else: 4256 takeoff = gtk.RadioButton(nominal, 4257 xstr("takeoff_derate_tupolev_takeoff")) 4214 takeoff = gtk.RadioButton.\ 4215 new_with_label_from_widget(nominal, 4216 xstr("takeoff_derate_tupolev_takeoff")) 4258 4217 4259 4218 takeoff.set_use_underline(True) … … 4462 4421 table.attach(label, 1, 2, row, row + 1) 4463 4422 4464 if pygobject: 4465 self._star = gtk.ComboBox.new_with_model_and_entry(comboModel) 4466 else: 4467 self._star = gtk.ComboBoxEntry(comboModel) 4423 self._star = gtk.ComboBox.new_with_model_and_entry(comboModel) 4468 4424 4469 4425 self._star.set_entry_text_column(0) … … 4482 4438 table.attach(label, 1, 2, row, row + 1) 4483 4439 4484 if pygobject: 4485 self._transition = gtk.ComboBox.new_with_model_and_entry(comboModel) 4486 else: 4487 self._transition = gtk.ComboBoxEntry(comboModel) 4440 self._transition = gtk.ComboBox.new_with_model_and_entry(comboModel) 4488 4441 4489 4442 self._transition.set_entry_text_column(0) … … 5499 5452 self.show_all() 5500 5453 pageSizeRequest = page.size_request() 5501 width = pageSizeRequest.width if pygobject else pageSizeRequest[0]5502 height = pageSizeRequest.height if pygobject else pageSizeRequest[1]5454 width = pageSizeRequest.width 5455 height = pageSizeRequest.height 5503 5456 maxWidth = max(maxWidth, width) 5504 5457 maxHeight = max(maxHeight, height) -
src/mlx/gui/flightlist.py
r983 r994 145 145 scrolledWindow.set_size_request(widthRequest, -1) 146 146 # FIXME: these should be constants in common.py 147 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 148 else gtk.POLICY_AUTOMATIC, 149 gtk.PolicyType.AUTOMATIC if pygobject 150 else gtk.POLICY_AUTOMATIC) 151 scrolledWindow.set_shadow_type(gtk.ShadowType.IN if pygobject 152 else gtk.SHADOW_IN) 147 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 148 gtk.PolicyType.AUTOMATIC) 149 scrolledWindow.set_shadow_type(gtk.ShadowType.IN) 153 150 154 151 super(FlightList, self).__init__(xalign = 0.5, yalign = 0.0, … … 222 219 self._popupMenu = self._popupMenuProducer() 223 220 menu = self._popupMenu 224 if pygobject: 225 menu.popup(None, None, None, None, event.button, event.time) 226 else: 227 menu.popup(None, None, None, event.button, event.time) 221 menu.popup(None, None, None, None, event.button, event.time) 228 222 229 223 def _selectionChanged(self, selection): -
src/mlx/gui/gates.py
r919 r994 64 64 scrolledWindow.set_size_request(200, -1) 65 65 # FIXME: these should be constants in common.py 66 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 67 else gtk.POLICY_AUTOMATIC, 68 gtk.PolicyType.AUTOMATIC if pygobject 69 else gtk.POLICY_AUTOMATIC) 70 scrolledWindow.set_shadow_type(gtk.ShadowType.IN if pygobject 71 else gtk.SHADOW_IN) 66 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 67 gtk.PolicyType.AUTOMATIC) 68 scrolledWindow.set_shadow_type(gtk.ShadowType.IN) 72 69 73 70 … … 165 162 self._fleetStore.append([tailNumber, status]) 166 163 # FIXME: this should be a constant in common.py 167 self._fleetStore.set_sort_column_id(0, 168 gtk.SortType.ASCENDING if pygobject 169 else gtk.SORT_ASCENDING) 164 self._fleetStore.set_sort_column_id(0, gtk.SortType.ASCENDING) 170 165 171 166 occupiedGateNumbers = fleet.getOccupiedGateNumbers() -
src/mlx/gui/gui.py
r954 r994 206 206 self._statusIcon = StatusIcon(iconDirectory, self) 207 207 208 self._busyCursor = gdk.Cursor(gdk.CursorType.WATCH if pygobject 209 else gdk.WATCH) 208 self._busyCursor = gdk.Cursor(gdk.CursorType.WATCH) 210 209 211 210 self._loadPIREPDialog = None … … 444 443 return self._flightInfo.faultsFullyExplained 445 444 446 if pygobject: 447 @property 448 def backgroundColour(self): 449 """Get the background colour of the main window.""" 450 return self._mainWindow.get_style_context().\ 451 get_background_color(gtk.StateFlags.NORMAL) 445 @property 446 def backgroundColour(self): 447 """Get the background colour of the main window.""" 448 return self._mainWindow.get_style_context().\ 449 get_background_color(gtk.StateFlags.NORMAL) 452 450 453 451 def run(self): … … 741 739 def _handleMainWindowState(self, window, event): 742 740 """Hande a change in the state of the window""" 743 iconified = gdk.WindowState.ICONIFIED if pygobject \ 744 else gdk.WINDOW_STATE_ICONIFIED 741 iconified = gdk.WindowState.ICONIFIED 745 742 746 743 if (event.changed_mask&WINDOW_STATE_WITHDRAWN)!=0: … … 750 747 self._statusIcon.mainWindowShown() 751 748 752 if self.config.hideMinimizedWindow and not pygobject and \ 753 (event.changed_mask&WINDOW_STATE_ICONIFIED)!=0 and \ 754 (event.new_window_state&WINDOW_STATE_ICONIFIED)!=0: 755 self.hideMainWindow(savePosition = False) 756 elif (event.changed_mask&WINDOW_STATE_ICONIFIED)!=0 and \ 757 (event.new_window_state&WINDOW_STATE_ICONIFIED)==0: 749 if (event.changed_mask&WINDOW_STATE_ICONIFIED)!=0 and \ 750 (event.new_window_state&WINDOW_STATE_ICONIFIED)==0: 758 751 self._mainWindow.present() 759 752 … … 798 791 self._mainWindow.move(self._mainWindowX, self._mainWindowY) 799 792 800 if pygobject: 801 self._mainWindow.show() 802 else: 803 self._mainWindow.present() 793 self._mainWindow.show() 804 794 self._mainWindow.deiconify() 805 795 … … 1239 1229 logScroller = gtk.ScrolledWindow() 1240 1230 # FIXME: these should be constants in common 1241 logScroller.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 1242 else gtk.POLICY_AUTOMATIC, 1243 gtk.PolicyType.AUTOMATIC if pygobject 1244 else gtk.POLICY_AUTOMATIC) 1245 logScroller.set_shadow_type(gtk.ShadowType.IN if pygobject 1246 else gtk.SHADOW_IN) 1231 logScroller.set_policy(gtk.PolicyType.AUTOMATIC, 1232 gtk.PolicyType.AUTOMATIC) 1233 logScroller.set_shadow_type(gtk.ShadowType.IN) 1247 1234 logView = gtk.TextView() 1248 1235 logView.set_editable(False) … … 1849 1836 dialog.set_license(xstr("about_license")) 1850 1837 1851 if not pygobject:1852 gtk.about_dialog_set_url_hook(self._showAboutURL, None)1853 1854 1838 self._aboutDialog = dialog 1855 1839 -
src/mlx/gui/pirep.py
r986 r994 71 71 self.show_all() 72 72 73 if pygobject: 74 styleContext = self.get_style_context() 75 color = styleContext.get_background_color(gtk.StateFlags.NORMAL) 76 heading.override_background_color(0, color) 77 else: 78 style = self.rc_get_style() 79 heading.modify_base(0, style.bg[0]) 73 styleContext = self.get_style_context() 74 color = styleContext.get_background_color(gtk.StateFlags.NORMAL) 75 heading.override_background_color(0, color) 80 76 81 77 … … 1225 1221 # FIXME: quite the same as the SID combo box in 1226 1222 # the flight wizard 1227 if pygobject: 1228 self._sid = gtk.ComboBox.new_with_model_and_entry(comboModel) 1229 else: 1230 self._sid = gtk.ComboBoxEntry(comboModel) 1223 self._sid = gtk.ComboBox.new_with_model_and_entry(comboModel) 1231 1224 1232 1225 self._sid.set_entry_text_column(0) … … 1260 1253 1261 1254 # FIXME: quite the same as in the wizard 1262 if pygobject: 1263 self._star = gtk.ComboBox.new_with_model_and_entry(comboModel) 1264 else: 1265 self._star = gtk.ComboBoxEntry(comboModel) 1255 self._star = gtk.ComboBox.new_with_model_and_entry(comboModel) 1266 1256 1267 1257 self._star.set_entry_text_column(0) … … 1275 1265 1276 1266 # FIXME: quite the same as in the wizard 1277 if pygobject: 1278 self._transition = gtk.ComboBox.new_with_model_and_entry(comboModel) 1279 else: 1280 self._transition = gtk.ComboBoxEntry(comboModel) 1267 self._transition = gtk.ComboBox.new_with_model_and_entry(comboModel) 1281 1268 1282 1269 self._transition.set_entry_text_column(0) -
src/mlx/gui/statusbar.py
r919 r994 30 30 self._connected = False 31 31 32 self.set_shadow_type(gtk.ShadowType.NONE if pygobject 33 else gtk.SHADOW_NONE) 32 self.set_shadow_type(gtk.ShadowType.NONE) 34 33 35 34 frameAlignment = gtk.Alignment(xscale = 1.0, yscale = 1.0) … … 55 54 self._connStateArea.set_tooltip_markup(xstr("statusbar_conn_tooltip")) 56 55 57 if pygobject: 58 self._connStateArea.connect("draw", self._drawConnState) 59 else: 60 self._connStateArea.connect("expose_event", self._drawConnState) 56 self._connStateArea.connect("draw", self._drawConnState) 61 57 62 58 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5) … … 130 126 icon = self._connGreyIcon 131 127 132 if pygobject: 133 gdk.cairo_set_source_pixbuf(eventOrContext, icon, 0, 0) 134 eventOrContext.paint() 135 else: 136 gc = connStateArea.get_style().fg_gc[gtk.STATE_NORMAL] 137 drawable = connStateArea.get_window() 138 drawable.draw_pixbuf(gc, icon, 0, 0, 0, 0) 128 gdk.cairo_set_source_pixbuf(eventOrContext, icon, 0, 0) 129 eventOrContext.paint() 139 130 140 131 def _updateFlightStatus(self): -
src/mlx/gui/statusicon.py
r919 r994 74 74 75 75 if appIndicator: 76 if pygobject: 77 indicator = appindicator.Indicator.new ("mava-logger-x", iconFile, 78 appindicator.IndicatorCategory.APPLICATION_STATUS) 79 indicator.set_status (appindicator.IndicatorStatus.ACTIVE) 80 else: 81 indicator = appindicator.Indicator ("mava-logger-x", iconFile, 82 appindicator.CATEGORY_APPLICATION_STATUS) 83 indicator.set_status (appindicator.STATUS_ACTIVE) 76 indicator = appindicator.Indicator.new ("mava-logger-x", iconFile, 77 appindicator.IndicatorCategory.APPLICATION_STATUS) 78 indicator.set_status (appindicator.IndicatorStatus.ACTIVE) 84 79 85 80 indicator.set_menu(menu) … … 127 122 """Hide and destroy the status icon.""" 128 123 if appIndicator: 129 if pygobject: 130 self._indicator.set_status(appindicator.IndicatorStatus.PASSIVE) 131 else: 132 self._indicator.set_status(appindicator.STATUS_PASSIVE) 124 self._indicator.set_status(appindicator.IndicatorStatus.PASSIVE) 133 125 else: 134 126 self._statusIcon.set_visible(False) -
src/mlx/gui/timetable.py
r927 r994 107 107 108 108 # FIXME: these should be constants in common.py 109 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC if pygobject 110 else gtk.POLICY_AUTOMATIC, 111 gtk.PolicyType.AUTOMATIC if pygobject 112 else gtk.POLICY_AUTOMATIC) 113 scrolledWindow.set_shadow_type(gtk.ShadowType.IN if pygobject 114 else gtk.SHADOW_IN) 109 scrolledWindow.set_policy(gtk.PolicyType.AUTOMATIC, 110 gtk.PolicyType.AUTOMATIC) 111 scrolledWindow.set_shadow_type(gtk.ShadowType.IN) 115 112 116 113 super(Timetable, self).__init__(xalign = 0.5, yalign = 0.0, … … 191 188 self._popupMenu = self._popupMenuProducer() 192 189 menu = self._popupMenu 193 if pygobject: 194 menu.popup(None, None, None, None, event.button, event.time) 195 else: 196 menu.popup(None, None, None, event.button, event.time) 190 menu.popup(None, None, None, None, event.button, event.time) 197 191 198 192 def _selectionChanged(self, selection): -
src/mlx/gui/update.py
r755 r994 55 55 window.connect("delete-event", lambda a, b: True) 56 56 window.set_deletable(False) 57 window.set_position(gtk.WindowPosition.CENTER_ON_PARENT if pygobject 58 else gtk.WIN_POS_CENTER_ON_PARENT) 57 window.set_position(gtk.WindowPosition.CENTER_ON_PARENT) 59 58 60 59 mainAlignment = gtk.Alignment(xscale = 1.0) … … 82 81 gtk.Dialog(WINDOW_TITLE_BASE + " " + xstr("update_title"), 83 82 parentWindow, 84 gtk.DialogFlags.MODAL if pygobject else gtk.DIALOG_MODAL)83 gtk.DialogFlags.MODAL) 85 84 sudoDialog.add_button(xstr("button_cancel"), 0) 86 85 sudoDialog.add_button(xstr("button_ok"), 1) … … 91 90 92 91 infoLabel = gtk.Label(xstr("update_needsudo")) 93 infoLabel.set_justify(gtk.Justification.CENTER if pygobject 94 else gtk.JUSTIFY_CENTER) 92 infoLabel.set_justify(gtk.Justification.CENTER) 95 93 infoLabelAlignment.add(infoLabel) 96 94 sudoDialog.vbox.pack_start(infoLabelAlignment, True, True, 4) 97 95 98 sudoDialog.set_position(gtk.WindowPosition.CENTER_ON_PARENT if pygobject 99 else gtk.WIN_POS_CENTER_ON_PARENT) 96 sudoDialog.set_position(gtk.WindowPosition.CENTER_ON_PARENT) 100 97 101 98 def __init__(self, gui, programDirectory, updateURL, parentWindow): -
src/mlx/gui/weighthelp.py
r303 r994 72 72 label.set_use_markup(True) 73 73 # FIXME: should be a constant in common 74 label.set_justify(gtk.Justification.CENTER if pygobject 75 else gtk.JUSTIFY_CENTER) 74 label.set_justify(gtk.Justification.CENTER) 76 75 alignment.add(label) 77 76 table.attach(alignment, 1, 2, 0, 1) … … 85 84 button.connect("clicked", self._fsButtonClicked) 86 85 label = button.get_child() 87 label.set_justify(gtk.Justification.CENTER if pygobject 88 else gtk.JUSTIFY_CENTER) 86 label.set_justify(gtk.Justification.CENTER) 89 87 alignment.add(button) 90 88 table.attach(alignment, 3, 4, 0, 1)
Note:
See TracChangeset
for help on using the changeset viewer.