示例#1
0
文件: action.py 项目: zarumaru/tryton
    def row_activate(self):
        if not self.screen.current_record:
            return

        if (self.screen.current_view.view_type == 'tree' and int(
                self.screen.current_view.attributes.get('keyword_open', 0))):
            GenericAction.exec_keyword(
                'tree_open', {
                    'model':
                    self.screen.model_name,
                    'id': (self.screen.current_record.id
                           if self.screen.current_record else None),
                    'ids': [r.id for r in self.screen.selected_records],
                },
                context=self.screen.group._context.copy(),
                warning=False)
        else:

            def callback(result):
                if result:
                    self.screen.current_record.save()
                else:
                    self.screen.current_record.cancel()

            WinForm(self.screen, callback, title=self.title.get_text())
示例#2
0
 def _action_favorite(widget, id_):
     event = gtk.get_current_event()
     allow_similar = (event.state & gtk.gdk.MOD1_MASK
                      or event.state & gtk.gdk.SHIFT_MASK)
     with Window(allow_similar=allow_similar):
         # ids is not defined to prevent to add suffix
         Action.exec_keyword('tree_open', {
             'model': self.menu_screen.model_name,
             'id': id_,
         })
示例#3
0
 def match_selected(completion, model, iter_):
     model, record_id, model_name = model.get(iter_, 2, 3, 4)
     if model == self.menu_screen.model_name:
         # ids is not defined to prevent to add suffix
         Action.exec_keyword('tree_open', {
             'model': model,
             'id': record_id,
         })
     else:
         Window.create(model,
                       res_id=record_id,
                       mode=['form', 'tree'],
                       name=model_name)
     self.global_search_entry.set_text('')
     return True
 def click_and_action(self, atype, value, path):
     return Action.exec_keyword(atype, {
         'model': self.screen.group.fields[
             path[1].name].attrs['relation'],
         'id': value or False,
         'ids': [value],
         }, alwaysask=True)
示例#5
0
 def menu_row_activate(self):
     screen = self.menu_screen
     record_id = (screen.current_record.id
         if screen.current_record else None)
     # ids is not defined to prevent to add suffix
     return Action.exec_keyword('tree_open', {
             'model': screen.model_name,
             'id': record_id,
             }, warning=False)
示例#6
0
文件: action.py 项目: Devecoop/tryton
    def row_activate(self):
        if not self.screen.current_record:
            return

        if (self.screen.current_view.view_type == 'tree' and
                self.screen.current_view.treeview.keyword_open):
            GenericAction.exec_keyword('tree_open', {
                'model': self.screen.model_name,
                'id': self.screen.id_get(),
                'ids': [self.screen.id_get()],
                }, context=self.screen.context.copy(), warning=False)
        else:
            def callback(result):
                if result:
                    self.screen.current_record.save()
                else:
                    self.screen.current_record.cancel()
            WinForm(self.screen, callback)
示例#7
0
    def row_activate(self):
        if not self.screen.current_record:
            return

        if (self.screen.current_view.view_type == 'tree' and
                self.screen.current_view.attributes.get('keyword_open')):
            GenericAction.exec_keyword('tree_open', {
                    'model': self.screen.model_name,
                    'id': (self.screen.current_record.id
                        if self.screen.current_record else None),
                    'ids': [r.id for r in self.screen.selected_records],
                    }, context=self.screen.context.copy(), warning=False)
        else:
            def callback(result):
                if result:
                    self.screen.current_record.save()
                else:
                    self.screen.current_record.cancel()
            WinForm(self.screen, callback)
示例#8
0
 def default_row_activate(self):
     if (self.current_view.view_type == 'tree' and
             self.current_view.attributes.get('keyword_open')):
         return Action.exec_keyword('tree_open', {
             'model': self.model_name,
             'id': self.current_record.id if self.current_record else None,
             'ids': [r.id for r in self.selected_records],
             }, context=self.context.copy(), warning=False)
     else:
         self.switch_view(view_type='form')
         return True
示例#9
0
 def default_row_activate(self):
     if (self.current_view.view_type == 'tree' and
             self.current_view.widget_tree.keyword_open):
         return Action.exec_keyword('tree_open', {
             'model': self.model_name,
             'id': self.id_get(),
             'ids': [self.id_get()],
             }, context=self.context.copy(), warning=False)
     else:
         self.switch_view(view_type='form')
         return True
示例#10
0
 def default_row_activate(self):
     if (self.current_view.view_type == 'tree'
             and self.current_view.widget_tree.keyword_open):
         return Action.exec_keyword('tree_open', {
             'model': self.model_name,
             'id': self.id_get(),
             'ids': [self.id_get()],
         },
                                    context=self.context.copy(),
                                    warning=False)
     else:
         self.switch_view(view_type='form')
         return True
示例#11
0
 def action_keyword(self, ids):
     if not ids:
         return
     ctx = self.group.context.copy()
     if 'active_ids' in ctx:
         del ctx['active_ids']
     if 'active_id' in ctx:
         del ctx['active_id']
     event = gtk.get_current_event()
     allow_similar = False
     if (event.state & gtk.gdk.CONTROL_MASK
             or event.state & gtk.gdk.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         return Action.exec_keyword('graph_open', {
                 'model': self.model,
                 'id': ids[0],
                 'ids': ids,
                 }, context=ctx, warning=False)
示例#12
0
文件: graph.py 项目: xyzlat/tryton
 def action_keyword(self, ids):
     if not ids:
         return
     ctx = self.group._context.copy()
     if 'active_ids' in ctx:
         del ctx['active_ids']
     if 'active_id' in ctx:
         del ctx['active_id']
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         return Action.exec_keyword('graph_open', {
                 'model': self.model,
                 'id': ids[0],
                 'ids': ids,
                 }, context=ctx, warning=False)