Beispiel #1
0
    def activate_plugin_cb(self, pl_mgr, bnch):
        lname = bnch.pInfo.name.lower()
        menu = Widgets.Menu()
        item = menu.add_name("Focus")
        item.add_callback('activated', lambda *args: pl_mgr.set_focus(lname))
        item = menu.add_name("Unfocus")
        item.add_callback('activated', lambda *args: pl_mgr.clear_focus(lname))
        item = menu.add_name("Stop")
        item.add_callback('activated', lambda *args: pl_mgr.deactivate(lname))

        lblname = bnch.lblname
        lbl = Widgets.Label(lblname,
                            halign='center',
                            style='clickable',
                            menu=menu)
        lbl.set_tooltip("Right click for menu")
        # don't let this widget expand to fill the bar
        lbl.cfg_expand(0x0, 0x4)
        self.w.optray.remove(self.spacer)
        self.w.optray.add_widget(lbl, stretch=0)
        self.w.optray.add_widget(self.spacer, stretch=1)

        lbl.add_callback('activated', lambda w: pl_mgr.set_focus(lname))

        bnch.setvals(widget=lbl, label=lbl, menu=menu)
Beispiel #2
0
    def build_gui(self, container):

        hbox = Widgets.HBox()
        hbox.set_border_width(0)
        hbox.set_spacing(2)

        cbox1 = Widgets.ComboBox()
        self.w.channel = cbox1
        cbox1.set_tooltip("Select a channel")
        cbox1.add_callback('activated', self.channel_select_cb)
        if self.settings.get('show_channel_control', True):
            hbox.add_widget(cbox1, stretch=0)

        self.use_popup = self.settings.get('use_popup_menu', True)
        if self.use_popup:
            opmenu = Widgets.Menu()
            btn = Widgets.Button("Operation")
        else:
            opmenu = Widgets.ComboBox()
            opmenu.set_tooltip("Select an operation")
            hbox.add_widget(opmenu, stretch=0)
            btn = Widgets.Button("Go")

        self.w.operation = opmenu
        btn.add_callback('activated', self.invoke_op_cb)
        btn.set_tooltip("Invoke operation")
        self.w.opbtn = btn
        hbox.add_widget(btn, stretch=0)

        self.w.optray = Widgets.HBox()
        self.w.optray.set_border_width(0)
        self.w.optray.set_spacing(2)
        hbox.add_widget(self.w.optray, stretch=1)

        container.add_widget(hbox, stretch=0)
Beispiel #3
0
    def _mk_context_menu(self, thumbkey, chname, name, path, image_future):
        menu = Widgets.Menu()
        item = menu.add_name("Display")
        item.add_callback(
            'activated', lambda w: self.load_file(thumbkey, chname, name, path,
                                                  image_future))
        menu.add_separator()
        item = menu.add_name("Remove")
        item.add_callback(
            'activated',
            lambda w: self.fv.remove_image_by_name(chname, name, impath=path))

        return menu
Beispiel #4
0
    def _mk_context_menu(self, thumbkey, chname, info):
        """NOTE: currently not used, but left here to be reincorporated
        at some point.
        """
        menu = Widgets.Menu()
        item = menu.add_name("Display")
        item.add_callback(
            'activated', lambda w: self.load_file(
                thumbkey, chname, info.name, info.path, info.image_future))
        menu.add_separator()
        item = menu.add_name("Remove")
        item.add_callback(
            'activated', lambda w: self.fv.remove_image_by_name(
                chname, info.name, impath=info.path))

        return menu
Beispiel #5
0
    def activate_plugin_cb(self, pl_mgr, bnch):
        lname = bnch.pInfo.name.lower()
        menu = Widgets.Menu()
        item = menu.add_name("Focus")
        item.add_callback('activated', lambda *args: pl_mgr.set_focus(lname))
        item = menu.add_name("Unfocus")
        item.add_callback('activated', lambda *args: pl_mgr.clear_focus(lname))
        item = menu.add_name("Stop")
        item.add_callback('activated', lambda *args: pl_mgr.deactivate(lname))

        lblname = bnch.lblname
        lbl = Widgets.Label(lblname,
                            halign='center',
                            style='clickable',
                            menu=menu)
        lbl.set_tooltip("Right click for menu")
        self.w.optray.add_widget(lbl, stretch=0)

        lbl.add_callback('activated', lambda w: pl_mgr.set_focus(lname))

        bnch.setvals(widget=lbl, label=lbl, menu=menu)
Beispiel #6
0
    def build_gui(self, container):

        hbox = Widgets.HBox()
        hbox.set_border_width(0)
        hbox.set_spacing(2)

        cbox1 = Widgets.ComboBox()
        self.w.channel = cbox1
        cbox1.set_tooltip("Select a channel")
        cbox1.add_callback('activated', self.channel_select_cb)
        if self.settings.get('show_channel_control', True):
            hbox.add_widget(cbox1, stretch=0)

        self.use_popup = self.settings.get('use_popup_menu', True)
        opmenu = Widgets.Menu()
        btn = Widgets.Button("Operation")
        btn.set_tooltip("Invoke operation")
        btn.add_callback('activated', self.invoke_popup_cb)
        if not self.use_popup:
            hbox.add_widget(btn, stretch=0)
            self.w.opname = Widgets.Label('')
            hbox.add_widget(self.w.opname, stretch=0)
            btn = Widgets.Button("Go")
            btn.add_callback('activated', self.invoke_op_cb)

        self.w.operation = opmenu
        self.w.opbtn = btn
        hbox.add_widget(btn, stretch=0)

        self.w.optray = Widgets.HBox()
        self.w.optray.set_border_width(0)
        self.w.optray.set_spacing(2)

        # add a spacer to keep the icons aligned to the left
        self.spacer = Widgets.Label('')
        self.w.optray.add_widget(self.spacer, stretch=1)

        hbox.add_widget(self.w.optray, stretch=1)
        container.add_widget(hbox, stretch=0)
        self.gui_up = True
Beispiel #7
0
    def activate_plugin_cb(self, pl_mgr, bnch):
        if not self.gui_up:
            return
        spec = bnch.pInfo.spec
        optray = spec.get('optray', True)
        if not optray:
            return
        hidden = spec.get('hidden', False)
        if hidden:
            return

        lname = bnch.pInfo.name.lower()
        menu = Widgets.Menu()
        item = menu.add_name("Focus")
        item.add_callback('activated', lambda *args: pl_mgr.set_focus(lname))
        item = menu.add_name("Unfocus")
        item.add_callback('activated', lambda *args: pl_mgr.clear_focus(lname))
        item = menu.add_name("Stop")
        item.add_callback('activated', lambda *args: pl_mgr.deactivate(lname))
        item = menu.add_name("Reload")
        item.add_callback('activated',
                          lambda *args: pl_mgr.stop_reload_start(lname))

        lblname = bnch.lblname
        lbl = Widgets.Label(lblname,
                            halign='center',
                            style='clickable',
                            menu=menu)
        lbl.set_tooltip("Right click for menu")
        # don't let this widget expand to fill the bar
        lbl.cfg_expand(0x0, 0x4)
        self.w.optray.remove(self.spacer)
        self.w.optray.add_widget(lbl, stretch=0)
        self.w.optray.add_widget(self.spacer, stretch=1)

        bnch.setvals(widget=lbl, label=lbl, menu=menu)
        lbl.add_callback('activated', lambda w: pl_mgr.set_focus(lname))