コード例 #1
0
ファイル: fliprotate.py プロジェクト: CaptainAL/Spyder
 def add_buttons_to_layout(self, layout):
     """Add tool buttons to layout"""
      # Image orientation
     angle_label = QLabel(_("Angle (°):"))
     layout.addWidget(angle_label)
     self.angle_combo = QComboBox(self)
     self.angle_combo.addItems(self.ROTATION_ANGLES)
     self.angle_combo.setCurrentIndex(1)
     self.angle_combo.currentIndexChanged.connect(
                              lambda index: self.apply_transformation())
     layout.addWidget(self.angle_combo)
     layout.addSpacing(10)
     
     # Image flipping
     flip_label = QLabel(_("Flip:"))
     layout.addWidget(flip_label)
     hflip = create_toolbutton(self, text="", icon=get_icon("hflip.png"),
                       toggled=lambda state: self.apply_transformation(),
                       autoraise=False)
     self.hflip_btn = hflip
     layout.addWidget(hflip)
     vflip = create_toolbutton(self, text="", icon=get_icon("vflip.png"),
                       toggled=lambda state: self.apply_transformation(),
                       autoraise=False)
     self.vflip_btn = vflip
     layout.addWidget(vflip)
     layout.addSpacing(15)
     
     self.add_reset_button(layout)
コード例 #2
0
ファイル: cross_section.py プロジェクト: githubhjz/guiqwt
 def setup_actions(self):
     CrossSectionWidget.setup_actions(self)
     self.peritem_ac = create_action(
         self,
         _("Per image cross-section"),
         icon=get_icon("csperimage.png"),
         toggled=self.cs_plot.toggle_perimage_mode,
         tip=_(
             "Enable the per-image cross-section mode, "
             "which works directly on image rows/columns.\n"
             "That is the fastest method to compute "
             "cross-section curves but it ignores "
             "image transformations (e.g. rotation)"
         ),
     )
     self.applylut_ac = create_action(
         self,
         _("Apply LUT\n(contrast settings)"),
         icon=get_icon("csapplylut.png"),
         toggled=self.cs_plot.toggle_apply_lut,
         tip=_(
             "Apply LUT (Look-Up Table) contrast settings.\n"
             "This is the easiest way to compare images "
             "which have slightly different level ranges.\n\n"
             "Note: LUT is coded over 1024 levels (0...1023)"
         ),
     )
     self.peritem_ac.setChecked(True)
     self.applylut_ac.setChecked(False)
コード例 #3
0
ファイル: gui.py プロジェクト: hutchic/dd-agent
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        font = QFont(get_family(MONOSPACE), 10, QFont.Normal)

        info_icon = QLabel()
        icon = get_std_icon("MessageBoxInformation").pixmap(24, 24)
        info_icon.setPixmap(icon)
        info_icon.setFixedWidth(32)
        info_icon.setAlignment(Qt.AlignTop)

        self.service_status_label = QLabel()
        self.service_status_label.setWordWrap(True)
        self.service_status_label.setAlignment(Qt.AlignTop)
        self.service_status_label.setFont(font)

        self.desc_label = QLabel()
        self.desc_label.setWordWrap(True)
        self.desc_label.setAlignment(Qt.AlignTop)
        self.desc_label.setFont(font)

        self.group_desc = QGroupBox("Description", self)
        layout = QHBoxLayout()
        layout.addWidget(info_icon)
        layout.addWidget(self.desc_label)
        layout.addStretch()
        layout.addWidget(self.service_status_label)

        self.group_desc.setLayout(layout)

        self.editor = CodeEditor(self)
        self.editor.setup_editor(linenumbers=True, font=font)
        self.editor.setReadOnly(False)
        self.group_code = QGroupBox("Source code", self)
        layout = QVBoxLayout()
        layout.addWidget(self.editor)
        self.group_code.setLayout(layout)

        self.enable_button = QPushButton(get_icon("apply.png"), "Enable", self)

        self.save_button = QPushButton(get_icon("filesave.png"), "Save", self)

        self.disable_button = QPushButton(get_icon("delete.png"), "Disable", self)

        self.refresh_button = QPushButton(get_icon("restart.png"), "Refresh", self)
        hlayout = QHBoxLayout()
        hlayout.addWidget(self.save_button)
        hlayout.addWidget(self.enable_button)
        hlayout.addWidget(self.disable_button)
        hlayout.addWidget(self.refresh_button)

        vlayout = QVBoxLayout()
        vlayout.addWidget(self.group_desc)
        vlayout.addWidget(self.group_code)
        self.html_window = HTMLWindow()
        vlayout.addWidget(self.html_window)

        vlayout.addLayout(hlayout)
        self.setLayout(vlayout)

        self.current_file = None
コード例 #4
0
 def setup_actions(self):
     self.export_ac = self.export_tool.action
     self.lockscales_ac = create_action(
         self,
         _("Lock scales"),
         icon=get_icon('axes.png'),
         toggled=self.cs_plot.toggle_lockscales,
         tip=_("Lock scales to main plot axes"))
     self.lockscales_ac.setChecked(self.cs_plot.lockscales)
     self.autoscale_ac = create_action(
         self,
         _("Auto-scale"),
         icon=get_icon('csautoscale.png'),
         toggled=self.cs_plot.toggle_autoscale)
     self.autoscale_ac.toggled.connect(self.lockscales_ac.setDisabled)
     self.autoscale_ac.setChecked(self.cs_plot.autoscale_mode)
     self.refresh_ac = create_action(
         self,
         _("Refresh"),
         icon=get_icon('refresh.png'),
         triggered=lambda: self.cs_plot.update_plot())
     self.autorefresh_ac = create_action(
         self,
         _("Auto-refresh"),
         icon=get_icon('autorefresh.png'),
         toggled=self.cs_plot.toggle_autorefresh)
     self.autorefresh_ac.setChecked(self.cs_plot.autorefresh_mode)
コード例 #5
0
 def __init__(self,
              label,
              klass,
              button_text=None,
              button_icon=None,
              show_button=True,
              wordwrap=False,
              **kwargs):
     DataSetShowGroupBox.__init__(self,
                                  label,
                                  klass,
                                  wordwrap=wordwrap,
                                  **kwargs)
     if show_button:
         if button_text is None:
             button_text = _("Apply")
         if button_icon is None:
             button_icon = get_icon("apply.png")
         elif is_text_string(button_icon):
             button_icon = get_icon(button_icon)
         apply_btn = QPushButton(button_icon, button_text, self)
         apply_btn.clicked.connect(self.set)
         layout = self.edit.layout
         layout.addWidget(apply_btn, layout.rowCount(), 0, 1, -1,
                          Qt.AlignRight)
コード例 #6
0
ファイル: fliprotate.py プロジェクト: gyenney/Tools
    def add_buttons_to_layout(self, layout):
        """Add tool buttons to layout"""
        # Image orientation
        angle_label = QLabel(_("Angle (°):"))
        layout.addWidget(angle_label)
        self.angle_combo = QComboBox(self)
        self.angle_combo.addItems(self.ROTATION_ANGLES)
        self.angle_combo.setCurrentIndex(1)
        self.angle_combo.currentIndexChanged.connect(
            lambda index: self.apply_transformation())
        layout.addWidget(self.angle_combo)
        layout.addSpacing(10)

        # Image flipping
        flip_label = QLabel(_("Flip:"))
        layout.addWidget(flip_label)
        hflip = create_toolbutton(
            self,
            text="",
            icon=get_icon("hflip.png"),
            toggled=lambda state: self.apply_transformation(),
            autoraise=False)
        self.hflip_btn = hflip
        layout.addWidget(hflip)
        vflip = create_toolbutton(
            self,
            text="",
            icon=get_icon("vflip.png"),
            toggled=lambda state: self.apply_transformation(),
            autoraise=False)
        self.vflip_btn = vflip
        layout.addWidget(vflip)
        layout.addSpacing(15)

        self.add_reset_button(layout)
コード例 #7
0
 def setup_actions(self):
     CrossSectionWidget.setup_actions(self)
     self.peritem_ac = create_action(
         self,
         _("Per image cross-section"),
         icon=get_icon("csperimage.png"),
         toggled=self.cs_plot.toggle_perimage_mode,
         tip=_(
             "Enable the per-image cross-section mode, "
             "which works directly on image rows/columns.\n"
             "That is the fastest method to compute "
             "cross-section curves but it ignores "
             "image transformations (e.g. rotation)"
         ),
     )
     self.applylut_ac = create_action(
         self,
         _("Apply LUT\n(contrast settings)"),
         icon=get_icon("csapplylut.png"),
         toggled=self.cs_plot.toggle_apply_lut,
         tip=_(
             "Apply LUT (Look-Up Table) contrast settings.\n"
             "This is the easiest way to compare images "
             "which have slightly different level ranges.\n\n"
             "Note: LUT is coded over 1024 levels (0...1023)"
         ),
     )
     self.peritem_ac.setChecked(True)
     self.applylut_ac.setChecked(False)
コード例 #8
0
ファイル: simple_window.py プロジェクト: zgpglee/guiqwt
    def setup(self):
        """Setup window parameters"""
        self.setWindowIcon(get_icon("python.png"))
        self.setWindowTitle(APP_NAME)
        self.resize(QSize(600, 800))

        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(_("Welcome to guiqwt application example!"), 5000)

        # File menu
        file_menu = self.menuBar().addMenu(_("File"))
        new_action = create_action(
            self,
            _("New..."),
            shortcut="Ctrl+N",
            icon=get_icon("filenew.png"),
            tip=_("Create a new image"),
            triggered=self.new_image,
        )
        open_action = create_action(
            self,
            _("Open..."),
            shortcut="Ctrl+O",
            icon=get_icon("fileopen.png"),
            tip=_("Open an image"),
            triggered=self.open_image,
        )
        quit_action = create_action(
            self,
            _("Quit"),
            shortcut="Ctrl+Q",
            icon=get_std_icon("DialogCloseButton"),
            tip=_("Quit application"),
            triggered=self.close,
        )
        add_actions(file_menu, (new_action, open_action, None, quit_action))

        # Help menu
        help_menu = self.menuBar().addMenu("?")
        about_action = create_action(
            self,
            _("About..."),
            icon=get_std_icon("MessageBoxInformation"),
            triggered=self.about,
        )
        add_actions(help_menu, (about_action, ))

        main_toolbar = self.addToolBar("Main")
        add_actions(main_toolbar, (
            new_action,
            open_action,
        ))

        # Set central widget:
        toolbar = self.addToolBar("Image")
        self.mainwidget = CentralWidget(self, toolbar)
        self.setCentralWidget(self.mainwidget)
コード例 #9
0
ファイル: wipy_gui_v3.py プロジェクト: bhclowers/WIPYDAQ
    def setup(self):
        """Setup window parameters"""
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle(APP_NAME)
        self.resize(QSize(600, 800))
        
        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(_("Welcome to guiqwt application example!"), 5000)
        self.setupMainWidget()

        # File menu
        file_menu = self.menuBar().addMenu(_("File"))

        new_action = create_action(self, _("New..."),
                                   shortcut="Ctrl+N",
                                   icon=get_icon('filenew.png'),
                                   tip=_("Create a new image"),
                                   triggered=self.new_image)
        open_action = create_action(self, _("Open..."),
                                    shortcut="Ctrl+O",
                                    icon=get_icon('fileopen.png'),
                                    tip=_("Open an image"),
                                    triggered=self.open_image)
        quit_action = create_action(self, _("Quit"),
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        add_actions(file_menu, (new_action, open_action, None, quit_action))
        
        processing_menu = self.menuBar().addMenu(_("Processing"))
        autoscale_action = create_action(self, _("Autoscale"),
                                    shortcut="Ctrl+W",
                                    tip=_("Autoscale Graph"),
                                    triggered=self.plotWidget.autoScale)
        add_actions(processing_menu, (autoscale_action,))
        # Help menu
        help_menu = self.menuBar().addMenu("?")
        about_action = create_action(self, _("About..."),
                                     icon=get_std_icon('MessageBoxInformation'),
                                     triggered=self.about)
        add_actions(help_menu, (about_action,))
        
        main_toolbar = self.addToolBar("Main")
        add_actions(main_toolbar, (new_action, open_action, ))
        
        self.curFIFOVal = 0
        self.rdb = r.Redis('localhost')

        # self.setShortcuts()

        # self.setCentralWidget(self.plotWidget)
        self.setCentralWidget(self.main_dock)  
コード例 #10
0
ファイル: histogram.py プロジェクト: HaMF/guiqwt
 def setup_actions(self):
     fullrange_ac = create_action(self, _("Full range"),
                                  icon=get_icon("full_range.png"),
                                  triggered=self.histogram.set_full_range,
                                  tip=_("Scale the image's display range "
                                        "according to data range") )
     autorange_ac = create_action(self, _("Eliminate outliers"),
                                  icon=get_icon("eliminate_outliers.png"),
                                  triggered=self.eliminate_outliers,
                                  tip=_("Eliminate levels histogram "
                                        "outliers and scale the image's "
                                        "display range accordingly") )
     add_actions(self.toolbar, [fullrange_ac, autorange_ac])
コード例 #11
0
ファイル: qtwidgets.py プロジェクト: gyenney/Tools
 def __init__(self, label, klass, button_text=None, button_icon=None, show_button=True, wordwrap=False, **kwargs):
     DataSetShowGroupBox.__init__(self, label, klass, wordwrap=wordwrap, **kwargs)
     if show_button:
         if button_text is None:
             button_text = _("Apply")
         if button_icon is None:
             button_icon = get_icon("apply.png")
         elif is_text_string(button_icon):
             button_icon = get_icon(button_icon)
         apply_btn = QPushButton(button_icon, button_text, self)
         apply_btn.clicked.connect(self.set)
         layout = self.edit.layout
         layout.addWidget(apply_btn, layout.rowCount(), 0, 1, -1, Qt.AlignRight)
コード例 #12
0
ファイル: cross_section.py プロジェクト: stonebig/guiqwt-1
 def setup_actions(self):
     self.export_ac = self.export_tool.action
     self.autoscale_ac = create_action(self, _("Auto-scale"),
                                icon=get_icon('csautoscale.png'),
                                toggled=self.cs_plot.toggle_autoscale)
     self.autoscale_ac.setChecked(self.cs_plot.autoscale_mode)
     self.refresh_ac = create_action(self, _("Refresh"),
                                icon=get_icon('refresh.png'),
                                triggered=lambda: self.cs_plot.update_plot())
     self.autorefresh_ac = create_action(self, _("Auto-refresh"),
                                icon=get_icon('autorefresh.png'),
                                toggled=self.cs_plot.toggle_autorefresh)
     self.autorefresh_ac.setChecked(self.cs_plot.autorefresh_mode)
コード例 #13
0
ファイル: histogram.py プロジェクト: berrosse/guiqwt
 def setup_actions(self):
     fullrange_ac = create_action(self, _("Full range"),
                                  icon=get_icon("full_range.png"),
                                  triggered=self.histogram.set_full_range,
                                  tip=_("Scale the image's display range "
                                        "according to data range") )
     autorange_ac = create_action(self, _("Eliminate outliers"),
                                  icon=get_icon("eliminate_outliers.png"),
                                  triggered=self.eliminate_outliers,
                                  tip=_("Eliminate levels histogram "
                                        "outliers and scale the image's "
                                        "display range accordingly") )
     add_actions(self.toolbar, [fullrange_ac, autorange_ac])
コード例 #14
0
    def __init__(self, parent, toolbar):
        QSplitter.__init__(self, parent)
        self.data_ref = None
        self.setContentsMargins(10, 10, 10, 10)
        self.setOrientation(Qt.Vertical)

        dsinfo = DSInfo(self)
        self.addWidget(dsinfo)
        dsproperties = DSProperties(self)
        self.addWidget(dsproperties)
        imagelistwithproperties = ImageListWithProperties(self)
        self.addWidget(imagelistwithproperties)
        self.imagelist = imagelistwithproperties.imagelist
        self.imagelist.currentRowChanged.connect(self.current_item_changed)
        self.imagelist.itemSelectionChanged.connect(self.selection_changed)
        self.ds = dsproperties.datas
        self.info = dsinfo.datas
        self.ds.SIG_APPLY_BUTTON_CLICKED.connect(self.properties_changed)
        self.properties = imagelistwithproperties.properties
        self.properties.SIG_APPLY_BUTTON_CLICKED.connect(
            self.properties_changed)

        self.imagewidget = CurveWidget(self)
        self.item = None
        self.flagitem = None
        self.flagname = ""

        self.imagewidget.add_toolbar(toolbar, "default")
        self.imagewidget.register_standard_tools()

        flag = create_action(self,
                             _("Get preflag from file..."),
                             icon=get_icon('eraser.png'),
                             tip=_("Get a preflag from file"),
                             triggered=self.preflag)
        fit = create_action(self,
                            _("Open fit window..."),
                            icon=get_icon('polyline.png'),
                            tip=_("Open fit window"),
                            triggered=self.fit_win)
        #apply = create_action(self, _("Apply fit file..."),
        #                      icon=get_icon('export.png'), tip=_("Apply fit file"),
        #                      triggered=self.apply_fit)
        add_actions(toolbar, [None, flag, fit])
        self.addWidget(self.imagewidget)

        self.images = []
        self.setStretchFactor(0, 0)
        self.setStretchFactor(1, 1)
        self.setHandleWidth(10)
        self.setSizes([50, 100, 200, 600])
コード例 #15
0
ファイル: fit.py プロジェクト: CaptainAL/Spyder
 def create_autofit_group(self):        
     auto_button = QPushButton(get_icon('apply.png'), _("Run"), self)
     auto_button.clicked.connect(self.autofit)
     autoprm_button = QPushButton(get_icon('settings.png'), _("Settings"),
                                  self)
     autoprm_button.clicked.connect(self.edit_parameters)
     xrange_button = QPushButton(get_icon('xrange.png'), _("Bounds"), self)
     xrange_button.setCheckable(True)
     xrange_button.toggled.connect(self.toggle_xrange)
     auto_layout = QVBoxLayout()
     auto_layout.addWidget(auto_button)
     auto_layout.addWidget(autoprm_button)
     auto_layout.addWidget(xrange_button)
     self.button_list += [auto_button, autoprm_button, xrange_button]
     return create_groupbox(self, _("Automatic fit"), layout=auto_layout)
コード例 #16
0
 def create_autofit_group(self):
     auto_button = QPushButton(get_icon("apply.png"), _("Run"), self)
     auto_button.clicked.connect(self.autofit)
     autoprm_button = QPushButton(get_icon("settings.png"), _("Settings"),
                                  self)
     autoprm_button.clicked.connect(self.edit_parameters)
     xrange_button = QPushButton(get_icon("xrange.png"), _("Bounds"), self)
     xrange_button.setCheckable(True)
     xrange_button.toggled.connect(self.toggle_xrange)
     auto_layout = QVBoxLayout()
     auto_layout.addWidget(auto_button)
     auto_layout.addWidget(autoprm_button)
     auto_layout.addWidget(xrange_button)
     self.button_list += [auto_button, autoprm_button, xrange_button]
     return create_groupbox(self, _("Automatic fit"), layout=auto_layout)
コード例 #17
0
ファイル: syncplot.py プロジェクト: PierreRaybaut/guiqwt
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setWindowTitle(self.__doc__)
        self.setWindowIcon(get_icon("guiqwt.svg"))

        self.manager = manager = PlotManager(None)
        manager.set_main(self)
        self.subplotwidget = spwidget = SubplotWidget(manager, parent=self)
        self.setLayout(QW.QVBoxLayout())
        toolbar = QW.QToolBar(_("Tools"))
        manager.add_toolbar(toolbar)
        self.layout().addWidget(toolbar)
        self.layout().addWidget(spwidget)

        plot1 = CurvePlot(title="TL")
        plot2 = CurvePlot(title="TR")
        plot3 = CurvePlot(title="BL")
        plot4 = CurvePlot(title="BR")
        spwidget.add_subplot(plot1, 0, 0, "1")
        spwidget.add_subplot(plot2, 0, 1, "2")
        spwidget.add_subplot(plot3, 1, 0, "3")
        spwidget.add_subplot(plot4, 1, 1, "4")
        spwidget.add_itemlist()
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["1", "3"])
        manager.synchronize_axis(BasePlot.X_BOTTOM, ["2", "4"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["1", "2"])
        manager.synchronize_axis(BasePlot.Y_LEFT, ["3", "4"])

        self.manager.register_all_curve_tools()
コード例 #18
0
ファイル: qthelpers.py プロジェクト: mindw/guidata
def create_toolbutton(parent,
                      icon=None,
                      text=None,
                      triggered=None,
                      tip=None,
                      toggled=None,
                      shortcut=None,
                      autoraise=True,
                      enabled=None):
    """Create a QToolButton"""
    if autoraise:
        button = QToolButton(parent)
    else:
        button = QPushButton(parent)
    if text is not None:
        button.setText(text)
    if icon is not None:
        if is_text_string(icon):
            icon = get_icon(icon)
        button.setIcon(icon)
    if text is not None or tip is not None:
        button.setToolTip(text if tip is None else tip)
    if autoraise:
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        button.setAutoRaise(True)
    if triggered is not None:
        button.clicked.connect(triggered)
    if toggled is not None:
        button.toggled.connect(toggled)
        button.setCheckable(True)
    if shortcut is not None:
        button.setShortcut(shortcut)
    if enabled is not None:
        button.setEnabled(enabled)
    return button
コード例 #19
0
ファイル: dialog.py プロジェクト: soltesz-lab/spykeutils
 def _setup_widget_properties(self, wintitle, icon):
     self.setWindowTitle(wintitle)
     if isinstance(icon, basestring):
         icon = get_icon(icon)
     self.setWindowIcon(icon)
     self.setMinimumSize(320, 240)
     self.resize(720, 540)
コード例 #20
0
ファイル: dialogs.py プロジェクト: neurodebian/spykeutils
 def _setup_widget_properties(self, wintitle, icon):
     self.setWindowTitle(wintitle)
     if isinstance(icon, basestring):
         icon = get_icon(icon)
     self.setWindowIcon(icon)
     self.setMinimumSize(320, 240)
     self.resize(720, 540)
コード例 #21
0
    def setup(self):
        file_menu = self.menuBar().addMenu(_("File"))
        open_action = create_action(self,
                                    _("Open..."),
                                    shortcut="Ctrl+O",
                                    icon=get_icon('fileopen.png'),
                                    tip=_("Open an acquisition directory"),
                                    triggered=self.open)
        #apply_action = create_action(self, _("Apply"),
        #                             shortcut="Ctrl+A",
        #                             icon=get_icon('fileopen.png'),
        #                             tip=_("Open an acquisition directory"),
        #                             triggered=self.apply)
        quit_action = create_action(self,
                                    _("Quit"),
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        add_actions(file_menu, (open_action, None, quit_action))
        help_menu = self.menuBar().addMenu("?")
        about_action = create_action(
            self,
            _("About..."),
            icon=get_std_icon('MessageBoxInformation'),
            triggered=self.about)
        add_actions(help_menu, (about_action, ))

        main_toolbar = self.addToolBar("Main")
        add_actions(main_toolbar, (open_action, ))

        self.toolbar = self.addToolBar("Image")
コード例 #22
0
ファイル: pyplot.py プロジェクト: stonebig/guiqwt-1
    def __init__(self, wintitle):
        super(Window, self).__init__()
        self.default_tool = None
        self.plots = []
        self.itemlist = PlotItemList(None)
        self.contrast = ContrastAdjustment(None)
        self.xcsw = XCrossSection(None)
        self.ycsw = YCrossSection(None)
        
        self.manager = PlotManager(self)
        self.toolbar = QToolBar(_("Tools"), self)
        self.manager.add_toolbar(self.toolbar, "default")
        self.toolbar.setMovable(True)
        self.toolbar.setFloatable(True)
        self.addToolBar(Qt.TopToolBarArea, self.toolbar)

        frame = QFrame(self)
        self.setCentralWidget(frame)
        self.layout = QGridLayout()
        layout = QVBoxLayout(frame)
        frame.setLayout(layout)
        layout.addLayout(self.layout)
        self.frame = frame

        self.setWindowTitle(wintitle)
        self.setWindowIcon(get_icon('guiqwt.svg'))
コード例 #23
0
ファイル: qtitemwidgets.py プロジェクト: artillan/guidata
 def __init__(self, item, parent_layout):
     super(FloatArrayWidget, self).__init__(item, parent_layout)
     _label = item.get_prop_value("display", "label")
     self.groupbox = self.group = QGroupBox(_label)
     self.layout = QGridLayout()
     self.layout.setAlignment(Qt.AlignLeft)
     self.groupbox.setLayout(self.layout)
     
     self.first_line, self.dim_label = get_image_layout("shape.png",
                                _("Number of rows x Number of columns"))
     edit_button = QPushButton(get_icon("arredit.png"), "")
     edit_button.setToolTip(_("Edit array contents"))
     edit_button.setMaximumWidth(32)
     self.first_line.addWidget(edit_button)
     self.layout.addLayout(self.first_line, 0, 0)
     
     self.min_line, self.min_label = get_image_layout("min.png",
                                              _("Smallest element in array"))
     self.layout.addLayout(self.min_line, 1, 0)
     self.max_line, self.max_label = get_image_layout("max.png",
                                              _("Largest element in array"))
     self.layout.addLayout(self.max_line, 2, 0)
     
     edit_button.clicked.connect(self.edit_array)
     self.arr = None # le tableau si il a été modifié
     self.instance = None
コード例 #24
0
ファイル: guitest.py プロジェクト: stonebig/guidata
 def __init__(self, package, parent=None):
     QSplitter.__init__(self, parent)
     self.setWindowTitle(_("Tests - %s module") % package.__name__)
     self.setWindowIcon(get_icon("%s.svg" % package.__name__, "guidata.svg"))
     
     test_package_name = '%s.tests' % package.__name__
     _temp = __import__(test_package_name)
     test_package = sys.modules[test_package_name]
     
     tests = get_tests(test_package)
     listwidget = QListWidget(self)
     listwidget.addItems([osp.basename(test.filename) for test in tests])
     
     self.properties = TestPropertiesWidget(self)
     
     self.addWidget(listwidget)
     self.addWidget(self.properties)
     
     self.properties.run_button.clicked.connect(
                             lambda: tests[listwidget.currentRow()].run())
     self.properties.quit_button.clicked.connect(self.close)
     listwidget.currentRowChanged.connect(
                         lambda row: self.properties.set_item(tests[row]))
     listwidget.itemActivated.connect(
                         lambda: tests[listwidget.currentRow()].run())
     listwidget.setCurrentRow(0)
     
     QShortcut(QKeySequence("Escape"), self, self.close)
         
     self.setSizes([150, 1])
     self.setStretchFactor(1, 1)
     self.resize(QSize(950, 600))
     self.properties.set_item(tests[0])
コード例 #25
0
ファイル: qtitemwidgets.py プロジェクト: artillan/guidata
 def __init__(self, item, parent_layout):
     super(TabGroupWidget, self).__init__(item, parent_layout)
     self.tabs = QTabWidget()
     items = item.item.group
     self.widgets = []
     for item in items:
         if item.get_prop_value("display", parent_layout.instance,
                                "hide", False):
             continue
         item.set_prop("display", embedded=True)
         widget = parent_layout.build_widget(item)
         frame = QFrame()
         label = widget.item.get_prop_value("display", "label")
         icon = widget.item.get_prop_value("display", "icon", None)
         if icon is not None:
             self.tabs.addTab(frame, get_icon(icon), label)
         else:
             self.tabs.addTab(frame, label)
         layout = QGridLayout()
         layout.setAlignment(Qt.AlignTop)
         frame.setLayout(layout)
         widget.place_on_grid(layout, 0, 0, 1)
         try:
             widget.get()
         except Exception:
             print("Error building item :", item.item._name)
             raise
         self.widgets.append(widget)
コード例 #26
0
    def __init__(self, wintitle):
        super(Window, self).__init__()
        self.default_tool = None
        self.plots = []
        self.itemlist = PlotItemList(None)
        self.contrast = ContrastAdjustment(None)
        self.xcsw = XCrossSection(None)
        self.ycsw = YCrossSection(None)

        self.manager = PlotManager(self)
        self.toolbar = QToolBar(_("Tools"), self)
        self.manager.add_toolbar(self.toolbar, "default")
        self.toolbar.setMovable(True)
        self.toolbar.setFloatable(True)
        self.addToolBar(Qt.TopToolBarArea, self.toolbar)

        frame = QFrame(self)
        self.setCentralWidget(frame)
        self.layout = QGridLayout()
        layout = QVBoxLayout(frame)
        frame.setLayout(layout)
        layout.addLayout(self.layout)
        self.frame = frame

        self.setWindowTitle(wintitle)
        self.setWindowIcon(get_icon('guiqwt.svg'))
コード例 #27
0
ファイル: fitJL.py プロジェクト: yangwc123/MTRSimulation
 def create_widgets(self, parent, refresh_callback):
     self._refresh_callback = refresh_callback
     self.prefix_label = QLabel()
     font = self.prefix_label.font()
     font.setPointSize(font.pointSize() + self._size_offset)
     self.prefix_label.setFont(font)
     self.button = QPushButton()
     self.button.setIcon(get_icon('settings.png'))
     self.button.setToolTip(
         _("Edit '%s' fit parameter properties") % self.name)
     QObject.connect(self.button, SIGNAL('clicked()'),
                     lambda: self.edit_param(parent))
     self.lineedit = QLineEdit()
     QObject.connect(self.lineedit, SIGNAL('editingFinished()'),
                     self.line_editing_finished)
     self.unit_label = QLabel(self.unit)
     self.slider = QSlider()
     self.slider.setOrientation(Qt.Horizontal)
     self.slider.setRange(0, self.steps - 1)
     QObject.connect(self.slider, SIGNAL("valueChanged(int)"),
                     self.slider_value_changed)
     self.update(refresh=False)
     self.add_widgets([
         self.prefix_label, self.lineedit, self.unit_label, self.slider,
         self.button
     ])
コード例 #28
0
ファイル: qthelpers.py プロジェクト: Alwnikrotikz/guidata
def create_toolbutton(parent, icon=None, text=None, triggered=None, tip=None,
                      toggled=None, shortcut=None, autoraise=True,
                      enabled=None):
    """Create a QToolButton"""
    if autoraise:
        button = QToolButton(parent)
    else:
        button = QPushButton(parent)
    if text is not None:
        button.setText(text)
    if icon is not None:
        if is_text_string(icon):
            icon = get_icon(icon)
        button.setIcon(icon)
    if text is not None or tip is not None:
        button.setToolTip(text if tip is None else tip)
    if autoraise:
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
        button.setAutoRaise(True)
    if triggered is not None:
        parent.connect(button, SIGNAL('clicked()'), triggered)
    if toggled is not None:
        parent.connect(button, SIGNAL("toggled(bool)"), toggled)
        button.setCheckable(True)
    if shortcut is not None:
        button.setShortcut(shortcut)
    if enabled is not None:
        button.setEnabled(enabled)
    return button
コード例 #29
0
ファイル: guitest.py プロジェクト: mindw/guidata
    def __init__(self, package, parent=None):
        QSplitter.__init__(self, parent)
        self.setWindowTitle(_("Tests - %s module") % package.__name__)
        self.setWindowIcon(get_icon("%s.svg" % package.__name__,
                                    "guidata.svg"))

        test_package_name = '%s.tests' % package.__name__
        _temp = __import__(test_package_name)
        test_package = sys.modules[test_package_name]

        tests = get_tests(test_package)
        listwidget = QListWidget(self)
        listwidget.addItems([osp.basename(test.filename) for test in tests])

        self.properties = TestPropertiesWidget(self)

        self.addWidget(listwidget)
        self.addWidget(self.properties)

        self.properties.run_button.clicked.connect(
            lambda: tests[listwidget.currentRow()].run())
        self.properties.quit_button.clicked.connect(self.close)
        listwidget.currentRowChanged.connect(
            lambda row: self.properties.set_item(tests[row]))
        listwidget.itemActivated.connect(
            lambda: tests[listwidget.currentRow()].run())
        listwidget.setCurrentRow(0)

        QShortcut(QKeySequence("Escape"), self, self.close)

        self.setSizes([150, 1])
        self.setStretchFactor(1, 1)
        self.resize(QSize(950, 600))
        self.properties.set_item(tests[0])
コード例 #30
0
ファイル: widgets.py プロジェクト: HaMF/bbfmr
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)

        self.widget_layout = QVBoxLayout()

        title_layout = QHBoxLayout()
        title_layout.addStretch()
        style = "<span style=\'color: #444444\'><b>%s</b></span>"
        title = QLabel(style % "Operations")
        title_layout.addWidget(title)
        title_layout.addStretch()
        self.widget_layout.addLayout(title_layout)

        # Create ListWidget and add 10 items to move around.
        self.list_widget = QListWidget()

        # self.list_widget.setDragDropMode(QAbstractItemView.InternalMove)
        self.list_widget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.list_widget.setSortingEnabled(False)
        self.list_widget.currentItemChanged.connect(self._populate_settings_update)
        self.widget_layout.addWidget(self.list_widget)

        otitle_layout = QHBoxLayout()
        otitle_layout.addStretch()
        otitle = QLabel(style % "Operation settings")
        otitle_layout.addWidget(otitle)
        otitle_layout.addStretch()
        self.widget_layout.addLayout(otitle_layout)

        self.operations_combo = QComboBox()
        self.operations_combo.currentIndexChanged.connect(self._populate_settings_add)
        self.widget_layout.addWidget(self.operations_combo)

        self.operation_settings = GenericOperationWidget()
        self.widget_layout.addWidget(self.operation_settings)

        self.toolbar = QToolBar()
        self.toolbar.addAction(get_icon('apply.png'), "Apply/Replace",
                               self._change_operation)
        self.toolbar.addAction(get_icon('editors/edit_add.png'), "Add after",
                               self._add_operation)
        self.toolbar.addAction(get_icon('trash.png'), "Remove",
                               self._remove_operation)


        self.widget_layout.addWidget(self.toolbar)
        self.setLayout(self.widget_layout)
コード例 #31
0
ファイル: gui.py プロジェクト: arthurnn/dd-agent
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        self.setIcon(get_icon("agent.png"))
        self.setVisible(True)
        self.options = {}

        menu = Menu(self.parent())
        self.setContextMenu(menu)
コード例 #32
0
ファイル: base.py プロジェクト: mindw/guiqwt
 def add_apply_button(self, layout):
     """Add the standard apply button"""
     apply_btn = create_toolbutton(self, text=_("Apply"),
                                   icon=get_icon("apply.png"),
                                   triggered=self.apply_transformation,
                                   autoraise=False)
     layout.addWidget(apply_btn)
     layout.addStretch()
コード例 #33
0
ファイル: panels.py プロジェクト: CaptainAL/Spyder
 def __init__(self, parent=None):
     super(PanelWidget, self).__init__(parent)
     assert self.PANEL_ID is not None
     if self.PANEL_TITLE is not None:
         self.setWindowTitle(self.PANEL_TITLE)
     if self.PANEL_ICON is not None:
         from guidata.configtools import get_icon
         self.setWindowIcon(get_icon(self.PANEL_ICON))
コード例 #34
0
    def __init__(self, parent=None):
        QSystemTrayIcon.__init__(self, parent)
        self.setIcon(get_icon("agent.png"))
        self.setVisible(True)
        self.options = {}

        menu = Menu(self.parent())
        self.setContextMenu(menu)
コード例 #35
0
 def __init__(self, parent=None):
     super(PanelWidget, self).__init__(parent)
     assert self.PANEL_ID is not None
     if self.PANEL_TITLE is not None:
         self.setWindowTitle(self.PANEL_TITLE)
     if self.PANEL_ICON is not None:
         from guidata.configtools import get_icon
         self.setWindowIcon(get_icon(self.PANEL_ICON))
コード例 #36
0
ファイル: plot.py プロジェクト: alimuldal/guiqwt
 def setup_widget_properties(self, wintitle, icon):
     self.setWindowTitle(wintitle)
     if is_text_string(icon):
         icon = get_icon(icon)
     if icon is not None:
         self.setWindowIcon(icon)
     self.setMinimumSize(320, 240)
     self.resize(640, 480)
コード例 #37
0
ファイル: plot.py プロジェクト: CARIBOuSystem/guiqwt
 def setup_widget_properties(self, wintitle, icon):
     self.setWindowTitle(wintitle)
     if is_text_string(icon):
         icon = get_icon(icon)
     if icon is not None:
         self.setWindowIcon(icon)
     self.setMinimumSize(320, 240)
     self.resize(640, 480)
コード例 #38
0
ファイル: base.py プロジェクト: mindw/guiqwt
 def add_reset_button(self, layout):
     """Add the standard reset button"""
     edit_options_btn = create_toolbutton(self, text=_("Reset"),
                                          icon=get_icon("eraser.png"),
                                          triggered=self.reset,
                                          autoraise=False)
     layout.addWidget(edit_options_btn)
     layout.addStretch()
コード例 #39
0
ファイル: cross_section.py プロジェクト: CARIBOuSystem/guiqwt
 def setup_actions(self):
     self.export_ac = self.export_tool.action
     self.autoscale_ac = create_action(
         self,
         _("Auto-scale"),
         icon=get_icon('csautoscale.png'),
         toggled=self.cs_plot.toggle_autoscale)
     self.autoscale_ac.setChecked(self.cs_plot.autoscale_mode)
     self.refresh_ac = create_action(
         self,
         _("Refresh"),
         icon=get_icon('refresh.png'),
         triggered=lambda: self.cs_plot.update_plot())
     self.autorefresh_ac = create_action(
         self,
         _("Auto-refresh"),
         icon=get_icon('autorefresh.png'),
         toggled=self.cs_plot.toggle_autorefresh)
     self.autorefresh_ac.setChecked(self.cs_plot.autorefresh_mode)
コード例 #40
0
ファイル: simple_window.py プロジェクト: HaMF/guiqwt
 def setup(self):
     """Setup window parameters"""
     self.setWindowIcon(get_icon('python.png'))
     self.setWindowTitle(APP_NAME)
     self.resize(QSize(600, 800))
     
     # Welcome message in statusbar:
     status = self.statusBar()
     status.showMessage(_("Welcome to guiqwt application example!"), 5000)
     
     # File menu
     file_menu = self.menuBar().addMenu(_("File"))
     new_action = create_action(self, _("New..."),
                                shortcut="Ctrl+N",
                                icon=get_icon('filenew.png'),
                                tip=_("Create a new image"),
                                triggered=self.new_image)
     open_action = create_action(self, _("Open..."),
                                 shortcut="Ctrl+O",
                                 icon=get_icon('fileopen.png'),
                                 tip=_("Open an image"),
                                 triggered=self.open_image)
     quit_action = create_action(self, _("Quit"),
                                 shortcut="Ctrl+Q",
                                 icon=get_std_icon("DialogCloseButton"),
                                 tip=_("Quit application"),
                                 triggered=self.close)
     add_actions(file_menu, (new_action, open_action, None, quit_action))
     
     # Help menu
     help_menu = self.menuBar().addMenu("?")
     about_action = create_action(self, _("About..."),
                                  icon=get_std_icon('MessageBoxInformation'),
                                  triggered=self.about)
     add_actions(help_menu, (about_action,))
     
     main_toolbar = self.addToolBar("Main")
     add_actions(main_toolbar, (new_action, open_action, ))
     
     # Set central widget:
     toolbar = self.addToolBar("Image")
     self.mainwidget = CentralWidget(self, toolbar)
     self.setCentralWidget(self.mainwidget)
コード例 #41
0
ファイル: qtitemwidgets.py プロジェクト: artillan/guidata
 def __init__(self, item, parent_layout, filedialog):
     super(FileWidget, self).__init__(item, parent_layout)
     self.filedialog = filedialog
     button = QPushButton()
     fmt = item.get_prop_value("data", "formats")
     button.setIcon(get_icon('%s.png' % fmt[0].lower(), default='file.png'))
     button.clicked.connect(self.select_file)
     self.group.addWidget(button)
     self.basedir = item.get_prop_value("data", "basedir")
     self.all_files_first = item.get_prop_value("data", "all_files_first")
コード例 #42
0
ファイル: siggen.py プロジェクト: ve7it/NetworkAnalyser
    def setup(self, start_freq, bandwidth, numpts, max_hold):
        """Setup window parameters"""
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle(APP_NAME)
        #dt = QDesktopWidget()
        #print dt.numScreens(), dt.screenGeometry()
        #sz = dt.screenGeometry()

        #self.resize(QSize(sz.width()*9/10, sz.height()*9/10))

        # Welcome message in statusbar:
        status = self.statusBar()
        status.showMessage(_("Welcome to the Signal Generator application!"),
                           5000)

        # File menu
        file_menu = self.menuBar().addMenu(_("File"))

        open_action = create_action(self,
                                    _("Save"),
                                    shortcut="Ctrl+S",
                                    icon=get_std_icon("FileIcon"),
                                    tip=_("Save a File"),
                                    triggered=self.saveFileDialog)

        quit_action = create_action(self,
                                    _("Quit"),
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        add_actions(file_menu, (open_action, None, quit_action))

        # Help menu - prolly should just say "you're on your own..."!!
        help_menu = self.menuBar().addMenu("Help")
        about_action = create_action(
            self,
            _("About..."),
            icon=get_std_icon('MessageBoxInformation'),
            triggered=self.about)
        add_actions(help_menu, (about_action, ))

        main_toolbar = self.addToolBar("Main")

        # Calibration action?
        add_actions(main_toolbar, (open_action, ))

        # Set central widget:

        toolbar = self.addToolBar("Image")

        self.setCentralWidget(self.mainwidget)

        if max_hold:
            self.do_max_hold()
コード例 #43
0
ファイル: gui.py プロジェクト: ghessler/mon-agent
    def __init__(self, parent=None):

        QSplitter.__init__(self, parent)
        self.setWindowTitle(MAIN_WINDOW_TITLE)
        self.setWindowIcon(get_icon("agent.svg"))

        self.sysTray = SystemTray(self)

        self.connect(self.sysTray, SIGNAL(
            "activated(QSystemTrayIcon::ActivationReason)"), self.__icon_activated)

        checks = get_checks()
        datadog_conf = DatadogConf(
            get_config_path(), description="Agent settings file: datadog.conf")
        self.log_file = LogFile()

        listwidget = QListWidget(self)
        listwidget.addItems(
            [osp.basename(check.module_name).replace("_", " ").title() for check in checks])

        self.properties = PropertiesWidget(self)

        self.addWidget(listwidget)
        self.addWidget(self.properties)

        self.connect(self.properties.enable_button, SIGNAL("clicked()"),
                     lambda: enable_check(self.properties))

        self.connect(self.properties.disable_button, SIGNAL("clicked()"),
                     lambda: disable_check(self.properties))

        self.connect(self.properties.save_button, SIGNAL("clicked()"),
                     lambda: save_file(self.properties))

        self.connect(listwidget, SIGNAL('currentRowChanged(int)'),
                     lambda row: self.properties.set_item(checks[row]))

        self.connect(self.properties.edit_datadog_conf_button, SIGNAL('clicked()'),
                     lambda: self.properties.set_datadog_conf(datadog_conf))

        self.connect(self.properties.view_log_button, SIGNAL('clicked()'),
                     lambda: self.properties.set_log_file(self.log_file))

        self.manager_menu = Menu(self)
        self.connect(self.properties.menu_button, SIGNAL("clicked()"),
                     lambda: self.manager_menu.popup(self.properties.menu_button.mapToGlobal(QPoint(0, 0))))

        listwidget.setCurrentRow(0)

        self.setSizes([150, 1])
        self.setStretchFactor(1, 1)
        self.resize(QSize(950, 600))
        self.properties.set_datadog_conf(datadog_conf)

        self.do_refresh()
コード例 #44
0
ファイル: qtitemwidgets.py プロジェクト: artillan/guidata
 def update(self, value):
     """Reimplement LineEditWidget method"""
     LineEditWidget.update(self, value)
     color = text_to_qcolor(value)
     if color.isValid():
         bitmap = QPixmap(16, 16)
         bitmap.fill(color)
         icon = QIcon(bitmap)
     else:
         icon = get_icon("not_found")
     self.button.setIcon(icon)
コード例 #45
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon("python.png"))
        self.setWindowTitle("Application example")

        # Instantiate dataset-related widgets:
        self.groupbox1 = DataSetShowGroupBox("Activable dataset",
                                             ExampleDataSet,
                                             comment="")
        self.groupbox2 = DataSetShowGroupBox("Standard dataset",
                                             AnotherDataSet,
                                             comment="")
        self.groupbox3 = DataSetEditGroupBox("Standard dataset",
                                             OtherDataSet,
                                             comment="")
        self.groupbox4 = DataSetEditGroupBox("Standard dataset",
                                             ExampleMultiGroupDataSet,
                                             comment="")
        self.groupbox3.SIG_APPLY_BUTTON_CLICKED.connect(self.update_window)
        self.update_groupboxes()

        splitter = QSplitter(self)
        splitter.addWidget(self.groupbox1)
        splitter.addWidget(self.groupbox2)
        splitter.addWidget(self.groupbox3)
        splitter.addWidget(self.groupbox4)
        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)

        # File menu
        file_menu = self.menuBar().addMenu("File")
        quit_action = create_action(
            self,
            "Quit",
            shortcut="Ctrl+Q",
            icon=get_std_icon("DialogCloseButton"),
            tip="Quit application",
            triggered=self.close,
        )
        add_actions(file_menu, (quit_action, ))

        # Edit menu
        edit_menu = self.menuBar().addMenu("Edit")
        editparam1_action = create_action(self,
                                          "Edit dataset 1",
                                          triggered=self.edit_dataset1)
        editparam2_action = create_action(self,
                                          "Edit dataset 2",
                                          triggered=self.edit_dataset2)
        editparam4_action = create_action(self,
                                          "Edit dataset 4",
                                          triggered=self.edit_dataset4)
        add_actions(edit_menu,
                    (editparam1_action, editparam2_action, editparam4_action))
コード例 #46
0
ファイル: filtertest2.py プロジェクト: CaptainAL/Spyder
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowTitle("Signal filtering 2 (guiqwt)")
     self.setWindowIcon(get_icon('guiqwt.svg'))
     
     hlayout = QHBoxLayout()
     central_widget = QWidget(self)
     central_widget.setLayout(hlayout)
     self.setCentralWidget(central_widget)
     #---guiqwt plot manager
     self.manager = PlotManager(self)
コード例 #47
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowTitle("Signal filtering 2 (guiqwt)")
        self.setWindowIcon(get_icon('guiqwt.svg'))

        hlayout = QHBoxLayout()
        central_widget = QWidget(self)
        central_widget.setLayout(hlayout)
        self.setCentralWidget(central_widget)
        #---guiqwt plot manager
        self.manager = PlotManager(self)
コード例 #48
0
ファイル: qtitemwidgets.py プロジェクト: artillan/guidata
 def __init__(self, item, parent_layout):
     super(ButtonWidget, self).__init__(item, parent_layout)
     _label = self.item.get_prop_value("display", "label")
     self.button = self.group = QPushButton(_label)
     self.button.setToolTip(item.get_help())
     _icon = self.item.get_prop_value("display", "icon")
     if _icon is not None:
         if is_text_string(_icon):
             _icon = get_icon(_icon)
         self.button.setIcon(_icon)
     self.button.clicked.connect(self.clicked)
     self.cb_value = None
コード例 #49
0
ファイル: guitest.py プロジェクト: stonebig/guidata
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     font = QFont(get_family(MONOSPACE), 10, QFont.Normal)
     
     info_icon = QLabel()
     icon = get_std_icon('MessageBoxInformation').pixmap(24, 24)
     info_icon.setPixmap(icon)
     info_icon.setFixedWidth(32)
     info_icon.setAlignment(Qt.AlignTop)
     self.desc_label = QLabel()
     self.desc_label.setWordWrap(True)
     self.desc_label.setAlignment(Qt.AlignTop)
     self.desc_label.setFont(font)
     group_desc = QGroupBox(_("Description"), self)
     layout = QHBoxLayout()
     layout.addWidget(info_icon)
     layout.addWidget(self.desc_label)
     group_desc.setLayout(layout)
     
     self.editor = CodeEditor(self)
     self.editor.setup_editor(linenumbers=True, font=font)
     self.editor.setReadOnly(True)
     group_code = QGroupBox(_("Source code"), self)
     layout = QVBoxLayout()
     layout.addWidget(self.editor)
     group_code.setLayout(layout)
     
     self.run_button = QPushButton(get_icon("apply.png"),
                                   _("Run this script"), self)
     self.quit_button = QPushButton(get_icon("exit.png"), _("Quit"), self)
     hlayout = QHBoxLayout()
     hlayout.addWidget(self.run_button)
     hlayout.addStretch()
     hlayout.addWidget(self.quit_button)
     
     vlayout = QVBoxLayout()
     vlayout.addWidget(group_desc)
     vlayout.addWidget(group_code)
     vlayout.addLayout(hlayout)
     self.setLayout(vlayout)
コード例 #50
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setWindowIcon(get_icon('python.png'))
        self.setWindowTitle("P3 Ctrl")
        # Instantiate dataset-related widgets:
        self.group1 = DataSetEditGroupBox("Activable dataset",
                                             Processing, comment='')
        self.group1.SIG_APPLY_BUTTON_CLICKED.connect(self.group1._items[0].hi)
        splitter = QSplitter(self)
        splitter.addWidget(self.group1)

        self.setCentralWidget(splitter)
        self.setContentsMargins(10, 5, 10, 5)
コード例 #51
0
ファイル: cross_section.py プロジェクト: githubhjz/guiqwt
 def setup_actions(self):
     self.export_ac = self.export_tool.action
     self.lockscales_ac = create_action(
         self,
         _("Lock scales"),
         icon=get_icon("axes.png"),
         toggled=self.cs_plot.toggle_lockscales,
         tip=_("Lock scales to main plot axes"),
     )
     self.lockscales_ac.setChecked(self.cs_plot.lockscales)
     self.autoscale_ac = create_action(
         self, _("Auto-scale"), icon=get_icon("csautoscale.png"), toggled=self.cs_plot.toggle_autoscale
     )
     self.autoscale_ac.toggled.connect(self.lockscales_ac.setDisabled)
     self.autoscale_ac.setChecked(self.cs_plot.autoscale_mode)
     self.refresh_ac = create_action(
         self, _("Refresh"), icon=get_icon("refresh.png"), triggered=lambda: self.cs_plot.update_plot()
     )
     self.autorefresh_ac = create_action(
         self, _("Auto-refresh"), icon=get_icon("autorefresh.png"), toggled=self.cs_plot.toggle_autorefresh
     )
     self.autorefresh_ac.setChecked(self.cs_plot.autorefresh_mode)
コード例 #52
0
ファイル: gui.py プロジェクト: darkopetrovic/ZephyrApp
    def _setup_menu(self):
        # File menu
        file_menu = self.menuBar().addMenu(_("File"))
        settings_action = create_action(self, _("Settings"),
                                   icon=get_icon('settings.png'),
                                   tip=_("Settings"),
                                   triggered=self.edit_settings)
        quit_action = create_action(self, _("Quit"),
                                    shortcut="Ctrl+Q",
                                    icon=get_std_icon("DialogCloseButton"),
                                    tip=_("Quit application"),
                                    triggered=self.close)
        add_actions(file_menu, (settings_action, None, quit_action))

        # View menu
        view_menu = self.createPopupMenu()
        view_menu.setTitle(_(u"&View"))
        self.menuBar().addMenu(view_menu)

        # Help menu
        help_menu = self.menuBar().addMenu("?")
        about_action = create_action(self, _("About..."),
                                     icon=get_std_icon('MessageBoxInformation'),
                                     triggered=self.about)
        add_actions(help_menu, (about_action,))

        # Base toolbar
        self.connectAction = QAction(QIcon('common/disconnected.png'), 'Connect', self)
        self.connectAction.triggered.connect( self.connect_button )
        self.playAction = QAction(QIcon('common/play.png'), 'Play free', self)
        self.playAction.triggered.connect( self.start_free_session_button )
        self.stopAction = QAction(QIcon('common/stop.png'), 'Stop', self)
        self.stopAction.triggered.connect( self.stop_button )
        self.timedAction = QAction(QIcon('common/timed.png'), 'Start', self)
        self.timedAction.triggered.connect( self.start_timed_session_button )

        self.toolbar = self.addToolBar('Controls')
        self.toolbar.addAction( self.connectAction )
        self.toolbar.addAction( self.playAction )
        self.toolbar.addAction( self.stopAction )
        self.toolbar.addAction( self.timedAction )
        self.toolbar.setObjectName('Controls')

        # Time toolbar
        self.timer = Timer( self )
        self.connect( self.timer, SIGNAL( 'SessionStop' ), self.session_stop )
コード例 #53
0
ファイル: editgroupbox.py プロジェクト: Alwnikrotikz/guidata
 def __init__(self):
     QMainWindow.__init__(self)
     self.setWindowIcon(get_icon('python.png'))
     self.setWindowTitle("Application example")
     
     # Instantiate dataset-related widgets:
     self.groupbox1 = DataSetShowGroupBox("Activable dataset",
                                          ExampleDataSet, comment='')
     self.groupbox2 = DataSetShowGroupBox("Standard dataset",
                                          AnotherDataSet, comment='')
     self.groupbox3 = DataSetEditGroupBox("Standard dataset",
                                          OtherDataSet, comment='')
     self.groupbox4 = DataSetEditGroupBox("Standard dataset",
                                          ExampleMultiGroupDataSet, comment='')
     self.connect(self.groupbox3, SIGNAL("apply_button_clicked()"),
                  self.update_window)
     self.update_groupboxes()
     
     splitter = QSplitter(self)
     splitter.addWidget(self.groupbox1)
     splitter.addWidget(self.groupbox2)
     splitter.addWidget(self.groupbox3)
     splitter.addWidget(self.groupbox4)
     self.setCentralWidget(splitter)
     self.setContentsMargins(10, 5, 10, 5)
     
     # File menu
     file_menu = self.menuBar().addMenu("File")
     quit_action = create_action(self, "Quit",
                                 shortcut="Ctrl+Q",
                                 icon=get_std_icon("DialogCloseButton"),
                                 tip="Quit application",
                                 triggered=self.close)
     add_actions(file_menu, (quit_action, ))
     
     # Edit menu
     edit_menu = self.menuBar().addMenu("Edit")
     editparam1_action = create_action(self, "Edit dataset 1",
                                       triggered=self.edit_dataset1)
     editparam2_action = create_action(self, "Edit dataset 2",
                                       triggered=self.edit_dataset2)
     editparam4_action = create_action(self, "Edit dataset 4",
                                       triggered=self.edit_dataset4)
     add_actions(edit_menu, (editparam1_action,
                             editparam2_action,
                             editparam4_action))