Beispiel #1
0
    def gui_add_channel(self, chname=None):
        if not chname:
            self.chncnt += 1
            chname = "Image%d" % self.chncnt
        lbl = QtGui.QLabel('New channel name:')
        ent = QtGui.QLineEdit()
        ent.setText(chname)
        lbl2 = QtGui.QLabel('Workspace:')
        cbox = QtHelp.ComboBox()
        names = self.ds.get_wsnames()
        try:
            idx = names.index(self._lastwsname)
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)
        dialog = QtHelp.Dialog(
            "Add Channel", 0, [['Cancel', 0], ['Ok', 1]],
            lambda w, rsp: self.add_channel_cb(w, rsp, ent, cbox, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(lbl, stretch=0)
        layout.addWidget(ent, stretch=0)
        layout.addWidget(lbl2, stretch=0)
        layout.addWidget(cbox, stretch=0)
        dialog.show()
Beispiel #2
0
    def gui_add_channels(self):
        captions = (
            ('Prefix', 'entry'),
            ('Number', 'spinbutton'),
            ('Workspace', 'combobox'),
        )
        w, b = QtHelp.build_info(captions)
        b.prefix.setText("Image")
        b.number.setRange(1, 12)
        b.number.setSingleStep(1)
        b.number.setValue(1)

        cbox = b.workspace
        names = self.ds.get_wsnames()
        try:
            idx = names.index('channels')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        dialog = QtHelp.Dialog(
            "Add Channels", 0, [['Cancel', 0], ['Ok', 1]],
            lambda w, rsp: self.add_channels_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()
Beispiel #3
0
 def gui_delete_channel(self):
     chinfo = self.get_channelInfo()
     chname = chinfo.name
     lbl = QtGui.QLabel("Really delete channel '%s' ?" % (chname))
     dialog = QtHelp.Dialog(
         "Delete Channel", 0, [['Cancel', 0], ['Ok', 1]],
         lambda w, rsp: self.delete_channel_cb(w, rsp, chname))
     box = dialog.get_content_area()
     layout = QtGui.QVBoxLayout()
     box.setLayout(layout)
     layout.addWidget(lbl, stretch=0)
     dialog.show()
Beispiel #4
0
    def gui_add_channel(self, chname=None):
        if not chname:
            self.chncnt += 1
            chname = "Image%d" % self.chncnt
        lbl = QtGui.QLabel('New channel name:')

        ent = QtGui.QLineEdit()
        ent.setText(chname)
        #ent.set_activates_default(True)
        dialog = QtHelp.Dialog("New Channel", 0, [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.new_channel_cb(w, rsp, ent))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(lbl, stretch=0)
        layout.addWidget(ent, stretch=0)
        dialog.show()
Beispiel #5
0
    def gui_add_ws(self):
        captions = (('Workspace name', 'entry'), ('Workspace type',
                                                  'combobox'),
                    ('In workspace', 'combobox'), ('Channel prefix', 'entry'),
                    ('Number of channels', 'spinbutton'))
        w, b = QtHelp.build_info(captions)

        self.wscount += 1
        wsname = "ws%d" % (self.wscount)
        b.workspace_name.setText(wsname)

        cbox = b.workspace_type
        cbox.append_text("Tabs")
        cbox.append_text("Grid")
        cbox.append_text("MDI")
        cbox.setCurrentIndex(0)

        cbox = b.in_workspace
        names = self.ds.get_wsnames()
        names.insert(0, 'top level')
        try:
            idx = names.index('top level')
        except:
            idx = 0
        for name in names:
            cbox.append_text(name)
        cbox.setCurrentIndex(idx)

        b.channel_prefix.setText("Image")
        spnbtn = b.number_of_channels
        spnbtn.setRange(0, 12)
        spnbtn.setSingleStep(1)
        spnbtn.setValue(1)

        dialog = QtHelp.Dialog("Add Workspace", 0, [['Cancel', 0], ['Ok', 1]],
                               lambda w, rsp: self.new_ws_cb(w, rsp, b, names))
        box = dialog.get_content_area()
        layout = QtGui.QVBoxLayout()
        box.setLayout(layout)

        layout.addWidget(w, stretch=1)
        dialog.show()