Fix wizard in window and missing icon
Wizard in window must manage the new toolbar Every windows must have an icon attribute
This commit is contained in:
1 parent
cbb9be7c79
commit
ebd1701a40
3 files changed
+13
-3
No files matched your search
@@ -154,7 +154,7 @@ class Action(object):
|
||||
direct_print=action.get('direct_print', False),
|
||||
email_print=action.get('email_print', False),
|
||||
email=action.get('email'), name=action.get('name', False),
|
||||
context=context)
|
||||
context=context, icon=(action.get('icon.rec_name') or ''))
|
||||
else:
|
||||
Wizard.execute(action['wiz_name'], data, window,
|
||||
direct_print=action.get('direct_print', False),
|
||||
|
||||
@@ -29,10 +29,12 @@ class Window(object):
|
||||
|
||||
@staticmethod
|
||||
def create_wizard(action, datas, parent, state='init', direct_print=False,
|
||||
email_print=False, email=None, name=False, context=None):
|
||||
email_print=False, email=None, name=False, context=None,
|
||||
icon=None):
|
||||
from tryton.gui import Main
|
||||
from wizard import Wizard
|
||||
win = Wizard(parent, name=name)
|
||||
win.icon = icon
|
||||
Main.get_main().win_add(win)
|
||||
win.run(action, datas, state=state, direct_print=direct_print,
|
||||
email_print=email_print, email=email, context=context)
|
||||
@@ -16,6 +16,8 @@ class Wizard(SignalEvent):
|
||||
super(Wizard, self).__init__()
|
||||
self.window = window
|
||||
self.widget = gtk.VBox(spacing=3)
|
||||
self.toolbar_box = gtk.HBox()
|
||||
self.widget.pack_start(self.toolbar_box, False, True)
|
||||
self.widget.show()
|
||||
self.name = name or ''
|
||||
self.model = ''
|
||||
@@ -117,6 +119,9 @@ class Wizard(SignalEvent):
|
||||
self.end()
|
||||
|
||||
def destroy(self):
|
||||
if self.toolbar_box.get_children():
|
||||
toolbar = self.toolbar_box.get_children()[0]
|
||||
self.toolbar_box.remove(toolbar)
|
||||
if hasattr(self, 'screen'):
|
||||
self.screen.signal_unconnect(self)
|
||||
self.screen.destroy()
|
||||
@@ -125,7 +130,8 @@ class Wizard(SignalEvent):
|
||||
|
||||
def end(self):
|
||||
try:
|
||||
rpc.execute('wizard', self.action, 'delete', self.wiz_id)
|
||||
rpc.execute('wizard', self.action, 'delete', self.wiz_id,
|
||||
rpc.CONTEXT)
|
||||
#XXX to remove when company displayed in status bar
|
||||
rpc.context_reload()
|
||||
except Exception:
|
||||
@@ -217,6 +223,8 @@ class Wizard(SignalEvent):
|
||||
|
||||
self.widget.pack_start(eb, expand=False, fill=True, padding=3)
|
||||
|
||||
self.widget.pack_start(self.toolbar_box, False, True)
|
||||
|
||||
viewport = gtk.Viewport()
|
||||
viewport.set_shadow_type(gtk.SHADOW_NONE)
|
||||
viewport.add(self.screen.widget)
|
||||
|
||||
Reference in new issue
Block a user