Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(294)

Side by Side Diff: tryton/gui/main.py

Issue 115085: Add "Forms/Statusbar" option (Closed)
Patch Set: Created 15 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tryton/config.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #This file is part of Tryton. The COPYRIGHT file at the top level of 1 #This file is part of Tryton. The COPYRIGHT file at the top level of
2 #this repository contains the full copyright notices and license terms. 2 #this repository contains the full copyright notices and license terms.
3 import os 3 import os
4 import sys 4 import sys
5 import gettext 5 import gettext
6 import urlparse 6 import urlparse
7 import gobject 7 import gobject
8 import gtk 8 import gtk
9 import tryton.rpc as rpc 9 import tryton.rpc as rpc
10 from tryton.config import CONFIG, TRYTON_ICON, PIXMAPS_DIR, DATA_DIR, get_home_d ir 10 from tryton.config import CONFIG, TRYTON_ICON, PIXMAPS_DIR, DATA_DIR, get_home_d ir
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 settings = gtk.settings_get_default() 155 settings = gtk.settings_get_default()
156 settings.set_property('gtk-button-images', True) 156 settings.set_property('gtk-button-images', True)
157 settings.set_property('gtk-can-change-accels', 157 settings.set_property('gtk-can-change-accels',
158 CONFIG['client.can_change_accelerators']) 158 CONFIG['client.can_change_accelerators'])
159 try: 159 try:
160 settings.set_property('gtk-keynav-cursor-only', True) 160 settings.set_property('gtk-keynav-cursor-only', True)
161 except TypeError: 161 except TypeError:
162 pass 162 pass
163 163
164 self.sig_toolbar_show() 164 self.sig_toolbar_show()
165 self.sig_statusbar_show()
165 166
166 if os.name in ('nt', 'mac') or \ 167 if os.name in ('nt', 'mac') or \
167 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): 168 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
168 # Disable actions, on win32 we use os.startfile 169 # Disable actions, on win32 we use os.startfile
169 # and on mac we use /usr/bin/open 170 # and on mac we use /usr/bin/open
170 self.menuitem_actions.set_sensitive(False) 171 self.menuitem_actions.set_sensitive(False)
171 172
172 # Adding a timer the check to requests 173 # Adding a timer the check to requests
173 gobject.timeout_add(5 * 60 * 1000, self.request_set) 174 gobject.timeout_add(5 * 60 * 1000, self.request_set)
174 _MAIN.append(self) 175 _MAIN.append(self)
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 menuitem_form.set_submenu(menu_form) 653 menuitem_form.set_submenu(menu_form)
653 654
654 checkmenuitem_toolbar = gtk.CheckMenuItem(_('Toolbar')) 655 checkmenuitem_toolbar = gtk.CheckMenuItem(_('Toolbar'))
655 checkmenuitem_toolbar.connect('activate', 656 checkmenuitem_toolbar.connect('activate',
656 lambda menuitem: self.sig_toolbar_change(menuitem.get_active())) 657 lambda menuitem: self.sig_toolbar_change(menuitem.get_active()))
657 checkmenuitem_toolbar.set_accel_path('<tryton>/Options/Form/Toolbar') 658 checkmenuitem_toolbar.set_accel_path('<tryton>/Options/Form/Toolbar')
658 menu_form.add(checkmenuitem_toolbar) 659 menu_form.add(checkmenuitem_toolbar)
659 if CONFIG['form.toolbar']: 660 if CONFIG['form.toolbar']:
660 checkmenuitem_toolbar.set_active(True) 661 checkmenuitem_toolbar.set_active(True)
661 662
663 checkmenuitem_statusbar = gtk.CheckMenuItem(_('Statusbar'))
664 checkmenuitem_statusbar.connect('activate',
665 lambda menuitem: self.sig_statusbar_change(menuitem.get_active() ))
666 checkmenuitem_statusbar.set_accel_path('<tryton>/Options/Form/Statusbar' )
667 menu_form.add(checkmenuitem_statusbar)
668 if CONFIG['form.statusbar']:
669 checkmenuitem_statusbar.set_active(True)
670
662 checkmenuitem_save_width_height = gtk.CheckMenuItem(_('Save Width/Height ')) 671 checkmenuitem_save_width_height = gtk.CheckMenuItem(_('Save Width/Height '))
663 checkmenuitem_save_width_height.connect('activate', 672 checkmenuitem_save_width_height.connect('activate',
664 lambda menuitem: CONFIG.__setitem__('client.save_width_height', 673 lambda menuitem: CONFIG.__setitem__('client.save_width_height',
665 menuitem.get_active())) 674 menuitem.get_active()))
666 checkmenuitem_save_width_height.set_accel_path( 675 checkmenuitem_save_width_height.set_accel_path(
667 '<tryton>/Options/Form/Save Width Height') 676 '<tryton>/Options/Form/Save Width Height')
668 menu_form.add(checkmenuitem_save_width_height) 677 menu_form.add(checkmenuitem_save_width_height)
669 if CONFIG['client.save_width_height']: 678 if CONFIG['client.save_width_height']:
670 checkmenuitem_save_width_height.set_active(True) 679 checkmenuitem_save_width_height.set_active(True)
671 680
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 CONFIG['form.toolbar'] = value 964 CONFIG['form.toolbar'] = value
956 return self.sig_toolbar_show() 965 return self.sig_toolbar_show()
957 966
958 def sig_toolbar_show(self): 967 def sig_toolbar_show(self):
959 toolbar = CONFIG['form.toolbar'] 968 toolbar = CONFIG['form.toolbar']
960 if toolbar: 969 if toolbar:
961 self.toolbar.show() 970 self.toolbar.show()
962 else: 971 else:
963 self.toolbar.hide() 972 self.toolbar.hide()
964 973
974 def sig_statusbar_change(self, value):
975 CONFIG['form.statusbar'] = value
976 return self.sig_statusbar_show()
977
978 def sig_statusbar_show(self):
979 statusbar = CONFIG['form.statusbar']
980 try:
ced1 2009/09/10 10:09:03 Why a try except ?
981 if statusbar:
982 self.status_hbox.show()
983 else:
984 self.status_hbox.hide()
985 except:
986 return
987
965 def sig_mode_change(self, pda_mode=False): 988 def sig_mode_change(self, pda_mode=False):
966 CONFIG['client.modepda'] = pda_mode 989 CONFIG['client.modepda'] = pda_mode
967 return 990 return
968 991
969 def sig_toolbar(self, option): 992 def sig_toolbar(self, option):
970 CONFIG['client.toolbar'] = option 993 CONFIG['client.toolbar'] = option
971 if option == 'default': 994 if option == 'default':
972 self.toolbar.set_style(False) 995 self.toolbar.set_style(False)
973 elif option == 'both': 996 elif option == 'both':
974 self.toolbar.set_style(gtk.TOOLBAR_BOTH) 997 self.toolbar.set_style(gtk.TOOLBAR_BOTH)
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1572
1550 if filename: 1573 if filename:
1551 file_ = file(filename, 'wb') 1574 file_ = file(filename, 'wb')
1552 file_.write(dump) 1575 file_.write(dump)
1553 file_.close() 1576 file_.close()
1554 common.message(_("Database backuped successfully!"), \ 1577 common.message(_("Database backuped successfully!"), \
1555 parent=self.window) 1578 parent=self.window)
1556 else: 1579 else:
1557 rpc.logout() 1580 rpc.logout()
1558 Main.get_main().refresh_ssl() 1581 Main.get_main().refresh_ssl()
OLDNEW
« no previous file with comments | « tryton/config.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b