nch(OpenERP) has proposed merging 
lp:~openerp-commiter/openobject-client/menuhelp into lp:openobject-client.

Requested reviews:
  OpenERP sa GTK client R&D (openerp-dev-gtk)


Hello,
This branch contains the feature:

for the help field of each menuitem
help field on ir_Act_window
the goal is that when a user opens a new menu for the first time, he gets a 
little bit of help like this one on the top of the screen
add a display_help function field on the ir.actions.window
it's a boolean function field that says if the help message has to be displayed 
or not.
according to what's in ir_act_window_user_rel
if the user/action is not in this table, it sees the help message. Otherise the 
help message is not displayed.
the client should receive the value of display_help field when we open a new 
window.
So, when a new user clicks on a menu, it gets a small help message (according 
to the action). He can close this help message (write a record in 
ir_act_window_user_rel). If he clsed the help message, he does not sees it 
anymore.

Thanks,
nch
-- 
https://code.launchpad.net/~openerp-commiter/openobject-client/menuhelp/+merge/29518
Your team OpenERP sa GTK client R&D is requested to review the proposed merge 
of lp:~openerp-commiter/openobject-client/menuhelp into lp:openobject-client.
=== modified file 'bin/common/common.py'
--- bin/common/common.py	2010-05-12 06:48:31 +0000
+++ bin/common/common.py	2010-07-09 05:10:59 +0000
@@ -370,7 +370,7 @@
     win.destroy()
     return True
 
-def message(msg, title=None, type=gtk.MESSAGE_INFO, parent=None):
+def message(msg, title=None, type=gtk.MESSAGE_INFO, parent=None, italic_font=False):
     if not parent:
         parent=service.LocalService('gui.main').window
     dialog = gtk.MessageDialog(parent,
@@ -378,8 +378,10 @@
       type, gtk.BUTTONS_OK)
     msg = to_xml(msg)
     if title is not None:
-        msg = '<b>%s</b>\n\n%s' % (to_xml(title), msg)
-
+        if italic_font:
+            msg = '<span foreground="red"><b>%s</b></span>\n\n\n<span font="italic">%s</span>' % (to_xml(title), msg)
+        else:
+            msg = '<b>%s</b>\n\n%s' % (to_xml(title), msg)
     dialog.set_icon(OPENERP_ICON)
     dialog.set_markup(msg)
     dialog.show_all()

=== modified file 'bin/modules/action/main.py'
--- bin/modules/action/main.py	2010-05-11 05:50:42 +0000
+++ bin/modules/action/main.py	2010-07-09 05:10:59 +0000
@@ -188,15 +188,29 @@
         for action in actions:
             keyact[action['name'].encode('utf8')] = action
         keyact.update(adds)
-
         res = common.selection(_('Select your action'), keyact)
         if res:
             (name,action) = res
             context.update(rpc.session.context)
+            if action.get('display_help', False):
+                action_id = action.get('id', False)
+                title = action.get('name', '')
+                help_msg =  action.get('help', False)
+                self.display_help(action_id, title, help_msg)
             self._exec_action(action, data, context=context)
             return (name, action)
         return False
 
+    def display_help(self, action_id=False, title='', help=False):
+        if not help:
+            return False
+        if title:
+            title = _(title)
+        common.message(help, title, italic_font=True)
+        value = {'default_user_ids':[(4, rpc.session.uid)]}
+        rpc.session.rpc_exec_auth('/object', 'execute',
+                        'ir.actions.act_window', 'write', action_id, value, rpc.session.context)
+        return True
 main()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to