Remove old workaround for PyGTK < 2.22
review2681003
This commit is contained in:
1 parent
cb313d2557
commit
093847ba43
12 files changed
+21
-43
No files matched your search
+1
-2
@@ -116,8 +116,7 @@ class TrytonClient(object):
|
||||
gtk.main()
|
||||
except KeyboardInterrupt:
|
||||
CONFIG.save()
|
||||
if hasattr(gtk, 'accel_map_save'):
|
||||
gtk.accel_map_save(os.path.join(get_config_dir(), 'accel.map'))
|
||||
gtk.accel_map_save(os.path.join(get_config_dir(), 'accel.map'))
|
||||
|
||||
if __name__ == "__main__":
|
||||
CLIENT = TrytonClient()
|
||||
|
||||
@@ -633,12 +633,8 @@ class WarningDialog(UniqueDialog):
|
||||
def build_dialog(self, parent, message, title, buttons=gtk.BUTTONS_OK):
|
||||
dialog = gtk.MessageDialog(parent, gtk.DIALOG_DESTROY_WITH_PARENT,
|
||||
gtk.MESSAGE_WARNING, buttons)
|
||||
if hasattr(dialog, 'format_secondary_markup'):
|
||||
dialog.set_markup('<b>%s</b>' % (to_xml(title)))
|
||||
dialog.format_secondary_markup(to_xml(message))
|
||||
else:
|
||||
dialog.set_markup(
|
||||
'<b>%s</b>\n%s' % (to_xml(title), to_xml(message)))
|
||||
dialog.set_markup('<b>%s</b>' % (to_xml(title)))
|
||||
dialog.format_secondary_markup(to_xml(message))
|
||||
return dialog
|
||||
|
||||
warning = WarningDialog()
|
||||
|
||||
@@ -17,8 +17,7 @@ def get_completion():
|
||||
completion.set_match_func(lambda *a: True)
|
||||
completion.set_model(gtk.ListStore(str, int))
|
||||
completion.set_text_column(0)
|
||||
if hasattr(completion.props, 'popup_set_width'):
|
||||
completion.props.popup_set_width = False
|
||||
completion.props.popup_set_width = False
|
||||
completion.insert_action_markup(0, _('<i>Search...</i>'))
|
||||
completion.insert_action_markup(1, _('<i>Create...</i>'))
|
||||
return completion
|
||||
|
||||
@@ -61,11 +61,10 @@ class DateEntry(gtk.Entry):
|
||||
self.connect('focus-in-event', self._focus_in)
|
||||
self.connect('focus-out-event', self._focus_out)
|
||||
|
||||
if hasattr(self, 'set_icon_from_stock'):
|
||||
self.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, 'tryton-find')
|
||||
self.set_icon_tooltip_text(gtk.ENTRY_ICON_SECONDARY,
|
||||
_('Open the calendar <F2>'))
|
||||
self.connect('icon-press', DateEntry.cal_open)
|
||||
self.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, 'tryton-find')
|
||||
self.set_icon_tooltip_text(gtk.ENTRY_ICON_SECONDARY,
|
||||
_('Open the calendar <F2>'))
|
||||
self.connect('icon-press', DateEntry.cal_open)
|
||||
|
||||
self._interactive_input = True
|
||||
self.idle_set_position(0)
|
||||
|
||||
+4
-8
@@ -130,8 +130,7 @@ class Main(object):
|
||||
gtk.accel_map_add_entry('<tryton>/Form/Search', gtk.keysyms.F,
|
||||
gtk.gdk.CONTROL_MASK)
|
||||
|
||||
if hasattr(gtk, 'accel_map_load'):
|
||||
gtk.accel_map_load(os.path.join(get_config_dir(), 'accel.map'))
|
||||
gtk.accel_map_load(os.path.join(get_config_dir(), 'accel.map'))
|
||||
|
||||
self.tooltips = common.Tooltips()
|
||||
|
||||
@@ -293,8 +292,7 @@ class Main(object):
|
||||
text_cell = gtk.CellRendererText()
|
||||
global_search_completion.pack_start(text_cell)
|
||||
global_search_completion.add_attribute(text_cell, "markup", 1)
|
||||
if hasattr(global_search_completion.props, 'popup_set_width'):
|
||||
global_search_completion.props.popup_set_width = True
|
||||
global_search_completion.props.popup_set_width = True
|
||||
self.global_search_entry.set_completion(global_search_completion)
|
||||
self.global_search_entry.set_icon_from_stock(gtk.ENTRY_ICON_PRIMARY,
|
||||
'gtk-find')
|
||||
@@ -1090,8 +1088,7 @@ class Main(object):
|
||||
CONFIG['client.default_width'] = Main.get_main()._width
|
||||
CONFIG['client.default_height'] = Main.get_main()._height
|
||||
CONFIG.save()
|
||||
if hasattr(gtk, 'accel_map_save'):
|
||||
gtk.accel_map_save(os.path.join(get_config_dir(), 'accel.map'))
|
||||
gtk.accel_map_save(os.path.join(get_config_dir(), 'accel.map'))
|
||||
|
||||
cls.tryton_client.quit_mainloop()
|
||||
|
||||
@@ -1186,8 +1183,7 @@ class Main(object):
|
||||
label_menu = gtk.Label(page.name)
|
||||
label_menu.set_alignment(0.0, 0.5)
|
||||
self.notebook.insert_page_menu(page.widget, hbox, label_menu, page_id)
|
||||
if hasattr(self.notebook, 'set_tab_reorderable'):
|
||||
self.notebook.set_tab_reorderable(page.widget, True)
|
||||
self.notebook.set_tab_reorderable(page.widget, True)
|
||||
self.notebook.set_current_page(page_id)
|
||||
|
||||
def _sig_remove_book(self, widget, page_widget):
|
||||
|
||||
@@ -89,8 +89,7 @@ class Time(Calendar):
|
||||
|
||||
def __init__(self, field_name, model_name, attrs=None):
|
||||
super(Time, self).__init__(field_name, model_name, attrs=attrs)
|
||||
if hasattr(self.entry, 'set_icon_from_stock'):
|
||||
self.entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)
|
||||
self.entry.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, None)
|
||||
|
||||
def get_format(self, record, field):
|
||||
return field.time_format(record)
|
||||
@@ -104,8 +104,7 @@ class DictSelectionEntry(DictEntry):
|
||||
widget.set_text_column(0)
|
||||
widget.child.set_width_chars(width)
|
||||
completion = gtk.EntryCompletion()
|
||||
if hasattr(completion, 'set_inline_selection'):
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_model(model)
|
||||
widget.child.set_completion(completion)
|
||||
completion.set_text_column(0)
|
||||
|
||||
@@ -29,9 +29,7 @@ class PopdownMixin(object):
|
||||
entry.set_model(model)
|
||||
entry.set_text_column(0)
|
||||
completion = gtk.EntryCompletion()
|
||||
#Only available in PyGTK 2.6 and above.
|
||||
if hasattr(completion, 'set_inline_selection'):
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_model(model)
|
||||
entry.child.set_completion(completion)
|
||||
if self._selection:
|
||||
|
||||
@@ -938,9 +938,7 @@ class Selection(Char, SelectionMixin):
|
||||
if hasattr(editable, 'set_text_column'):
|
||||
editable.set_text_column(0)
|
||||
completion = gtk.EntryCompletion()
|
||||
#Only available in PyGTK 2.6 and above.
|
||||
if hasattr(completion, 'set_inline_selection'):
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_inline_selection(True)
|
||||
completion.set_model(model)
|
||||
editable.get_child().set_completion(completion)
|
||||
completion.set_text_column(0)
|
||||
|
||||
@@ -103,10 +103,8 @@ class ScreenContainer(object):
|
||||
self.completion.set_model(gtk.ListStore(str))
|
||||
self.completion.set_text_column(0)
|
||||
self.completion.props.inline_completion = True
|
||||
if hasattr(self.completion.props, 'inline_selection'):
|
||||
self.completion.props.inline_selection = True
|
||||
if hasattr(self.completion.props, 'popup_set_width'):
|
||||
self.completion.props.popup_set_width = False
|
||||
self.completion.props.inline_selection = True
|
||||
self.completion.props.popup_set_width = False
|
||||
self.completion.set_match_func(lambda *a: True)
|
||||
self.completion.connect('match-selected', self.match_selected)
|
||||
self.search_entry.connect('activate', self.activate)
|
||||
@@ -431,8 +429,7 @@ class ScreenContainer(object):
|
||||
self.search_window.set_title('Tryton')
|
||||
self.search_window.set_icon(TRYTON_ICON)
|
||||
self.search_window.set_decorated(False)
|
||||
if hasattr(self.search_window, 'set_deletable'):
|
||||
self.search_window.set_deletable(False)
|
||||
self.search_window.set_deletable(False)
|
||||
self.search_window.connect('key-press-event', key_press)
|
||||
vbox = gtk.VBox()
|
||||
fields = [f for f in self.screen.domain_parser.fields.itervalues()
|
||||
|
||||
@@ -38,8 +38,7 @@ class WinForm(NoModal):
|
||||
self.win.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||
self.win.set_icon(TRYTON_ICON)
|
||||
self.win.set_has_separator(False)
|
||||
if hasattr(self.win, 'set_deletable'):
|
||||
self.win.set_deletable(False)
|
||||
self.win.set_deletable(False)
|
||||
self.win.connect('close', self.close)
|
||||
self.win.connect('response', self.response)
|
||||
|
||||
|
||||
@@ -295,8 +295,7 @@ class WizardDialog(Wizard, NoModal):
|
||||
gtk.DIALOG_DESTROY_WITH_PARENT)
|
||||
self.dia.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||
self.dia.set_icon(TRYTON_ICON)
|
||||
if hasattr(self.dia, 'set_deletable'):
|
||||
self.dia.set_deletable(False)
|
||||
self.dia.set_deletable(False)
|
||||
self.dia.connect('close', self.close)
|
||||
self.dia.connect('response', self.response)
|
||||
self.dia.connect('state-changed', self.state_changed)
|
||||
|
||||
Reference in new issue
Block a user