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

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

Issue 115085: Add "Forms/Statusbar" option (Closed)
Patch Set: Call set_statusbar before set_menubar 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 self.tooltips = common.Tooltips() 102 self.tooltips = common.Tooltips()
103 103
104 toolbar = gtk.Toolbar() 104 toolbar = gtk.Toolbar()
105 self.toolbar = toolbar 105 self.toolbar = toolbar
106 toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL) 106 toolbar.set_orientation(gtk.ORIENTATION_HORIZONTAL)
107 toolbar.set_style(gtk.TOOLBAR_BOTH) 107 toolbar.set_style(gtk.TOOLBAR_BOTH)
108 108
109 self.vbox = gtk.VBox() 109 self.vbox = gtk.VBox()
110 self.window.add(self.vbox) 110 self.window.add(self.vbox)
111 111
112 self.status_hbox = None
112 self.menubar = None 113 self.menubar = None
113 self.menuitem_user = None 114 self.menuitem_user = None
114 self.menuitem_form = None 115 self.menuitem_form = None
115 self.menuitem_plugins = None 116 self.menuitem_plugins = None
116 117
118 self.set_statusbar()
117 self.set_menubar() 119 self.set_menubar()
118 120
119 if igemacintegration: 121 if igemacintegration:
120 self.macmenu = igemacintegration.MacMenu() 122 self.macmenu = igemacintegration.MacMenu()
121 quit_item = gtk.MenuItem(_('Quit')) 123 quit_item = gtk.MenuItem(_('Quit'))
122 quit_item.connect('activate', self.sig_close) 124 quit_item.connect('activate', self.sig_close)
123 self.macmenu.set_quit_menu_item(quit_item) 125 self.macmenu.set_quit_menu_item(quit_item)
124 self.macdock = igemacintegration.MacDock() 126 self.macdock = igemacintegration.MacDock()
125 self.macdock.connect('quit-activate', self.sig_close) 127 self.macdock.connect('quit-activate', self.sig_close)
126 128
127 self.vbox.pack_start(toolbar, False, True) 129 self.vbox.pack_start(toolbar, False, True)
128 130
129 self.buttons = {} 131 self.buttons = {}
130 self._set_toolbar() 132 self._set_toolbar()
131 self.set_toolbar_label() 133 self.set_toolbar_label()
132 134
133 self.notebook = gtk.Notebook() 135 self.notebook = gtk.Notebook()
134 self.notebook.popup_enable() 136 self.notebook.popup_enable()
135 self.notebook.set_scrollable(True) 137 self.notebook.set_scrollable(True)
136 self.notebook.connect_after('switch-page', self._sig_page_changt) 138 self.notebook.connect_after('switch-page', self._sig_page_changt)
137 self.vbox.pack_start(self.notebook, True, True) 139 self.vbox.pack_start(self.notebook, True, True)
138 140
139 self.status_hbox = None
140 self.set_statusbar()
141
142 self.window.show_all() 141 self.window.show_all()
143 142
144 self.pages = [] 143 self.pages = []
145 self.previous_pages = {} 144 self.previous_pages = {}
146 self.current_page = 0 145 self.current_page = 0
147 self.last_page = 0 146 self.last_page = 0
148 147
149 if CONFIG['client.modepda']: 148 if CONFIG['client.modepda']:
150 self.radiomenuitem_pda.set_active(True) 149 self.radiomenuitem_pda.set_active(True)
151 else: 150 else:
152 self.radiomenuitem_normal.set_active(True) 151 self.radiomenuitem_normal.set_active(True)
153 self.sb_set() 152 self.sb_set()
154 153
155 settings = gtk.settings_get_default() 154 settings = gtk.settings_get_default()
156 settings.set_property('gtk-button-images', True) 155 settings.set_property('gtk-button-images', True)
157 settings.set_property('gtk-can-change-accels', 156 settings.set_property('gtk-can-change-accels',
158 CONFIG['client.can_change_accelerators']) 157 CONFIG['client.can_change_accelerators'])
159 try: 158 try:
160 settings.set_property('gtk-keynav-cursor-only', True) 159 settings.set_property('gtk-keynav-cursor-only', True)
161 except TypeError: 160 except TypeError:
162 pass 161 pass
163 162
164 self.sig_toolbar_show() 163 self.sig_toolbar_show()
164 self.sig_statusbar_show()
165 165
166 if os.name in ('nt', 'mac') or \ 166 if os.name in ('nt', 'mac') or \
167 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'): 167 (hasattr(os, 'uname') and os.uname()[0] == 'Darwin'):
168 # Disable actions, on win32 we use os.startfile 168 # Disable actions, on win32 we use os.startfile
169 # and on mac we use /usr/bin/open 169 # and on mac we use /usr/bin/open
170 self.menuitem_actions.set_sensitive(False) 170 self.menuitem_actions.set_sensitive(False)
171 171
172 # Adding a timer the check to requests 172 # Adding a timer the check to requests
173 gobject.timeout_add(5 * 60 * 1000, self.request_set) 173 gobject.timeout_add(5 * 60 * 1000, self.request_set)
174 _MAIN.append(self) 174 _MAIN.append(self)
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 menuitem_form.set_submenu(menu_form) 652 menuitem_form.set_submenu(menu_form)
653 653
654 checkmenuitem_toolbar = gtk.CheckMenuItem(_('Toolbar')) 654 checkmenuitem_toolbar = gtk.CheckMenuItem(_('Toolbar'))
655 checkmenuitem_toolbar.connect('activate', 655 checkmenuitem_toolbar.connect('activate',
656 lambda menuitem: self.sig_toolbar_change(menuitem.get_active())) 656 lambda menuitem: self.sig_toolbar_change(menuitem.get_active()))
657 checkmenuitem_toolbar.set_accel_path('<tryton>/Options/Form/Toolbar') 657 checkmenuitem_toolbar.set_accel_path('<tryton>/Options/Form/Toolbar')
658 menu_form.add(checkmenuitem_toolbar) 658 menu_form.add(checkmenuitem_toolbar)
659 if CONFIG['form.toolbar']: 659 if CONFIG['form.toolbar']:
660 checkmenuitem_toolbar.set_active(True) 660 checkmenuitem_toolbar.set_active(True)
661 661
662 checkmenuitem_statusbar = gtk.CheckMenuItem(_('Statusbar'))
663 checkmenuitem_statusbar.connect('activate',
664 lambda menuitem: self.sig_statusbar_change(menuitem.get_active() ))
665 checkmenuitem_statusbar.set_accel_path('<tryton>/Options/Form/Statusbar' )
666 menu_form.add(checkmenuitem_statusbar)
667 if CONFIG['form.statusbar']:
668 checkmenuitem_statusbar.set_active(True)
669
662 checkmenuitem_save_width_height = gtk.CheckMenuItem(_('Save Width/Height ')) 670 checkmenuitem_save_width_height = gtk.CheckMenuItem(_('Save Width/Height '))
663 checkmenuitem_save_width_height.connect('activate', 671 checkmenuitem_save_width_height.connect('activate',
664 lambda menuitem: CONFIG.__setitem__('client.save_width_height', 672 lambda menuitem: CONFIG.__setitem__('client.save_width_height',
665 menuitem.get_active())) 673 menuitem.get_active()))
666 checkmenuitem_save_width_height.set_accel_path( 674 checkmenuitem_save_width_height.set_accel_path(
667 '<tryton>/Options/Form/Save Width Height') 675 '<tryton>/Options/Form/Save Width Height')
668 menu_form.add(checkmenuitem_save_width_height) 676 menu_form.add(checkmenuitem_save_width_height)
669 if CONFIG['client.save_width_height']: 677 if CONFIG['client.save_width_height']:
670 checkmenuitem_save_width_height.set_active(True) 678 checkmenuitem_save_width_height.set_active(True)
671 679
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 CONFIG['form.toolbar'] = value 963 CONFIG['form.toolbar'] = value
956 return self.sig_toolbar_show() 964 return self.sig_toolbar_show()
957 965
958 def sig_toolbar_show(self): 966 def sig_toolbar_show(self):
959 toolbar = CONFIG['form.toolbar'] 967 toolbar = CONFIG['form.toolbar']
960 if toolbar: 968 if toolbar:
961 self.toolbar.show() 969 self.toolbar.show()
962 else: 970 else:
963 self.toolbar.hide() 971 self.toolbar.hide()
964 972
973 def sig_statusbar_change(self, value):
974 CONFIG['form.statusbar'] = value
975 return self.sig_statusbar_show()
976
977 def sig_statusbar_show(self):
978 statusbar = CONFIG['form.statusbar']
979 if statusbar:
980 self.status_hbox.show()
981 else:
982 self.status_hbox.hide()
983
965 def sig_mode_change(self, pda_mode=False): 984 def sig_mode_change(self, pda_mode=False):
966 CONFIG['client.modepda'] = pda_mode 985 CONFIG['client.modepda'] = pda_mode
967 return 986 return
968 987
969 def sig_toolbar(self, option): 988 def sig_toolbar(self, option):
970 CONFIG['client.toolbar'] = option 989 CONFIG['client.toolbar'] = option
971 if option == 'default': 990 if option == 'default':
972 self.toolbar.set_style(False) 991 self.toolbar.set_style(False)
973 elif option == 'both': 992 elif option == 'both':
974 self.toolbar.set_style(gtk.TOOLBAR_BOTH) 993 self.toolbar.set_style(gtk.TOOLBAR_BOTH)
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 1568
1550 if filename: 1569 if filename:
1551 file_ = file(filename, 'wb') 1570 file_ = file(filename, 'wb')
1552 file_.write(dump) 1571 file_.write(dump)
1553 file_.close() 1572 file_.close()
1554 common.message(_("Database backuped successfully!"), \ 1573 common.message(_("Database backuped successfully!"), \
1555 parent=self.window) 1574 parent=self.window)
1556 else: 1575 else:
1557 rpc.logout() 1576 rpc.logout()
1558 Main.get_main().refresh_ssl() 1577 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