示例#1
0
文件: tree.py 项目: gisce/erpclient
    def __init__(self, view, model, res_id=False, domain=[], context={}, window=None, name=False):
        self.glade = glade.XML(common.terp_path("openerp.glade"),'win_tree_container',gettext.textdomain())
        self.widget = self.glade.get_widget('win_tree_container')
        self.widget.show_all()
        self.model = view['model']
        self.domain2 = domain
        if view.get('field_parent', False):
            self.domain = []
        else:
            self.domain = domain
        self.view = view
        self.window=window

        self.context=context

        self.tree_res = view_tree.view_tree(view, [], res_id, True, context=context)
        self.tree_res.view.connect('row-activated', self.sig_open)

        sel = self.tree_res.view.get_selection()
        sel.connect('changed', self.expand_one)

        if not name:
            self.name = self.tree_res.name
        else:
            self.name = name
        self.vp = self.glade.get_widget('main_tree_sw')

        wid = self.glade.get_widget('widget_vbox')
        wid.show()

        widget_sc = self.glade.get_widget('win_tree_sc')

        widget_sc.connect('row-activated', self.sc_go)
        self.tree_sc = view_tree.view_tree_sc(widget_sc, self.model)
        self.handlers = {
            'but_reload': self.sig_reload,
            'but_switch': self.sig_edit,
            'but_chroot': self.sig_chroot,
            'but_open': self.sig_action,
            'but_action': self.sig_action,
            'but_print': self.sig_print,
            'but_print_html': self.sig_print_html,
            'but_close': self.sig_close,
            'but_save_as': self.sig_save_as,
        }
        dict = {
            'on_but_sc_go_clicked': self.sc_go,
            'on_but_sc_add_clicked': self.sc_add,
            'on_but_sc_del_clicked': self.sc_del,
            'on_but_expand_collapse_clicked': self.expand_collapse_all,
            'on_tbsc_clicked': self.sc_btn,
        }

        self.vp.add(self.tree_res.widget_get())
        self.sig_reload()

        for signal in dict:
            self.glade.signal_connect(signal, dict[signal])
        self.expand = True
示例#2
0
    def __init__(self, view, model, res_id=False, domain=[], context={}, help={}, window=None, name=False):
        self.glade = glade.XML(common.terp_path("openerp.glade"),'win_tree_container',gettext.textdomain())
        self.widget = self.glade.get_widget('win_tree_container')
        self.widget.show_all()
        self.model = view['model']
        self.domain2 = domain
        if view.get('field_parent', False):
            self.domain = []
        else:
            self.domain = domain
        self.view = view
        self.window=window

        self.context=context

        self.tree_res = view_tree.view_tree(view, [], res_id, True, context=context)
        self.tree_res.view.connect('row-activated', self.sig_open)

        sel = self.tree_res.view.get_selection()
        sel.connect('changed', self.expand_one)

        if not name:
            self.name = self.tree_res.name
        else:
            self.name = name
        self.vp = self.glade.get_widget('main_tree_sw')

        wid = self.glade.get_widget('widget_vbox')
        wid.show()

        widget_sc = self.glade.get_widget('win_tree_sc')

        widget_sc.connect('row-activated', self.sc_go)
        self.tree_sc = view_tree.view_tree_sc(widget_sc, self.model)
        self.handlers = {
            'but_reload': self.sig_reload,
            'but_switch': self.sig_edit,
            'but_chroot': self.sig_chroot,
            'but_open': self.sig_action,
            'but_action': self.sig_action,
            'but_print': self.sig_print,
            'but_print_html': self.sig_print_html,
            'but_close': self.sig_close,
            'but_save_as': self.sig_save_as,
        }
        dict = {
            'on_but_sc_go_clicked': self.sc_go,
            'on_but_sc_add_clicked': self.sc_add,
            'on_but_sc_del_clicked': self.sc_del,
            'on_but_expand_collapse_clicked': self.expand_collapse_all,
            'on_tbsc_clicked': self.sc_btn,
        }

        self.help = help
        self.help_frame = False
        wid = self.tree_res.widget_get()
        if self.help:
            action_tips = common.action_tips(self.help)
            self.help_frame = action_tips.help_frame
            if self.help_frame:
                vbox = gtk.VBox()
                vbox.pack_start(self.help_frame, expand=False, fill=False, padding=2)
                vbox.pack_end(wid)
                vbox.show_all()
                wid = vbox
        if self.help_frame:
            self.vp.add_with_viewport(wid)
        else:
            self.vp.add(wid)
        self.sig_reload()

        for signal in dict:
            self.glade.signal_connect(signal, dict[signal])
        self.expand = True
示例#3
0
    def __init__(self, view, model, res_id=False, domain=[], context={}, help={}, window=None, name=False):
        self.ui = openerp_gtk_builder('openerp.ui', ['win_tree_container'])
        self.widget = self.ui.get_object('win_tree_container')
        self.widget.show_all()
        self.model = view['model']
        self.domain2 = domain
        if view.get('field_parent', False):
            self.domain = []
        else:
            self.domain = domain
        self.view = view
        self.window=window

        self.context=context

        self.tree_res = view_tree.view_tree(view, [], res_id, True, context=context)
        self.tree_res.view.connect('row-activated', self.sig_open)

        sel = self.tree_res.view.get_selection()
        sel.connect('changed', self.expand_one)

        if not name:
            self.name = self.tree_res.name
        else:
            self.name = name
        self.vp = self.ui.get_object('main_tree_sw')

        wid = self.ui.get_object('widget_vbox')
        wid.show()

        widget_sc = self.ui.get_object('win_tree_sc')

        widget_sc.connect('row-activated', self.sc_go)
        self.tree_sc = view_tree.view_tree_sc(widget_sc, self.model)
        self.handlers = {
            'but_reload': self.sig_reload,
            'but_switch': self.sig_edit,
            'but_chroot': self.sig_chroot,
            'but_open': self.sig_action,
            'but_action': self.sig_action,
            'but_print': self.sig_print,
            'but_print_html': self.sig_print_html,
            'but_close': self.sig_close,
            'but_save_as': self.sig_save_as,
        }
        signal_dict = {
            'on_but_sc_go_clicked': self.sc_go,
            'on_but_sc_add_clicked': self.sc_add,
            'on_but_sc_del_clicked': self.sc_del,
            'on_but_expand_collapse_clicked': self.expand_collapse_all,
        }

        self.help = help
        self.help_frame = False
        wid = self.tree_res.widget_get()
        if self.help:
            action_tips = common.action_tips(self.help)
            self.help_frame = action_tips.help_frame
            if self.help_frame:
                vbox = gtk.VBox()
                vbox.pack_start(self.help_frame, expand=False, fill=False, padding=2)
                vbox.pack_end(wid)
                vbox.show_all()
                wid = vbox
        if self.help_frame:
            self.vp.add_with_viewport(wid)
        else:
            self.vp.add(wid)
        self.sig_reload()

        self.ui.connect_signals(signal_dict)
        self.expand = True