Пример #1
0
    def __init__(self, parent=None):
        super(MigrationWidget, self).__init__(parent, Qt.WindowStaysOnTopHint)
        self._migration = {}
        vbox = QVBoxLayout(self)
        lbl_title = QLabel(self.tr("Current code:"))
        self.current_list = QListWidget()
        lbl_suggestion = QLabel(self.tr("Suggested changes:"))
        self.suggestion = QPlainTextEdit()
        self.suggestion.setReadOnly(True)

        self.btn_apply = QPushButton(self.tr("Apply change!"))
        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(self.btn_apply)

        vbox.addWidget(lbl_title)
        vbox.addWidget(self.current_list)
        vbox.addWidget(lbl_suggestion)
        vbox.addWidget(self.suggestion)
        vbox.addLayout(hbox)

        self.connect(self.current_list,
                     SIGNAL("itemClicked(QListWidgetItem*)"),
                     self.load_suggestion)
        self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)

        IDE.register_service('tab_migration', self)
        ExplorerContainer.register_tab(translations.TR_TAB_MIGRATION, self)
Пример #2
0
    def __init__(self, suggested, parent=None):
        super(PythonDetectDialog, self).__init__(parent, Qt.Dialog)
        self.setMaximumSize(QSize(0, 0))
        self.setWindowTitle("Configure Python Path")

        vbox = QVBoxLayout(self)
        msg_str = ("We have detected that you are using "
                   "Windows,\nplease choose the proper "
                   "Python application for you:")
        lblMessage = QLabel(self.tr(msg_str))
        vbox.addWidget(lblMessage)

        self.listPaths = QListWidget()
        self.listPaths.setSelectionMode(QListWidget.SingleSelection)
        vbox.addWidget(self.listPaths)

        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        btnCancel = QPushButton(self.tr("Cancel"))
        btnAccept = QPushButton(self.tr("Accept"))
        hbox.addWidget(btnCancel)
        hbox.addWidget(btnAccept)
        vbox.addLayout(hbox)

        self.connect(btnAccept, SIGNAL("clicked()"), self._set_python_path)
        self.connect(btnCancel, SIGNAL("clicked()"), self.close)

        for path in suggested:
            self.listPaths.addItem(path)
        self.listPaths.setCurrentRow(0)
        def changeTileWidth():
            '''Change tile width (tile block size) and reset image-scene'''
            dlg = QDialog(self)
            dlg.setWindowTitle("Viewer Tile Width")
            dlg.setModal(True)
            
            spinBox = QSpinBox( parent=dlg )
            spinBox.setRange( 128, 10*1024 )
            spinBox.setValue( self.editor.imageScenes[0].tileWidth() )
                
            ctrl_layout = QHBoxLayout()
            ctrl_layout.addSpacerItem(QSpacerItem(10, 0, QSizePolicy.Expanding))
            ctrl_layout.addWidget( QLabel("Tile Width:") )
            ctrl_layout.addWidget( spinBox )

            button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, parent=dlg)
            button_box.accepted.connect( dlg.accept )
            button_box.rejected.connect( dlg.reject )
            
            dlg_layout = QVBoxLayout()
            dlg_layout.addLayout( ctrl_layout )
            dlg_layout.addWidget( QLabel("Setting will apply current view immediately,\n"
                                         "and all other views upon restart.") )
            dlg_layout.addWidget( button_box )

            dlg.setLayout( dlg_layout )
            
            if dlg.exec_() == QDialog.Accepted:
                for s in self.editor.imageScenes:
                    if s.tileWidth != spinBox.value():
                        s.setTileWidth( spinBox.value() )
                        s.reset()
Пример #4
0
def buildfromauto(formconfig, base):
    widgetsconfig = formconfig['widgets']

    outlayout = QFormLayout()
    outlayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
    outwidget = base
    outwidget.setLayout(outlayout)
    for config in widgetsconfig:
        widgettype = config['widget']
        field = config['field']
        name = config.get('name', field)
        if not field:
            utils.warning("Field can't be null for {}".format(name))
            utils.warning("Skipping widget")
            continue
        label = QLabel(name)
        label.setObjectName(field + "_label")
        widget = roam.editorwidgets.core.createwidget(widgettype, parent=base)
        widget.setObjectName(field)
        layoutwidget = QWidget()
        layoutwidget.setLayout(QBoxLayout(QBoxLayout.LeftToRight))
        layoutwidget.layout().addWidget(widget)
        if config.get('rememberlastvalue', False):
            savebutton = QToolButton()
            savebutton.setObjectName('{}_save'.format(field))
            layoutwidget.layout().addWidget(savebutton)

        outlayout.addRow(label, layoutwidget)

    outlayout.addItem(QSpacerItem(10, 500))
    installflickcharm(outwidget)
    return outwidget
    def __init__(self, parent, text, diffText):
        QDialog.__init__(self, parent)
        self.prm = self.parent().prm
        self.currLocale = self.parent().prm['currentLocale']
        self.currLocale.setNumberOptions(self.currLocale.OmitGroupSeparator | self.currLocale.RejectGroupSeparator)
        self.diffText = diffText
        self.vBoxSizer = QVBoxLayout()
        self.hBoxSizer = QHBoxLayout()
        self.textTF = QLabel(text)
        self.vBoxSizer.addWidget(self.textTF)

        self.yesButt = QPushButton(self.tr("Yes"), self)
        self.noButt = QPushButton(self.tr("No"), self)
        self.showDiffButt = QPushButton(self.tr("Show Differences"), self)
        self.cancelButt = QPushButton(self.tr("Cancel"), self)
        self.hBoxSizer.addItem(QSpacerItem(10,10, QSizePolicy.Expanding))
        self.hBoxSizer.addWidget(self.yesButt)
        self.hBoxSizer.addWidget(self.noButt)
        self.hBoxSizer.addWidget(self.showDiffButt)
        self.hBoxSizer.addWidget(self.cancelButt)
        self.vBoxSizer.addLayout(self.hBoxSizer)
        self.showDiffButt.clicked.connect(self.onClickShowDiffButt)
        self.cancelButt.clicked.connect(self.onClickCancelButt)
        self.yesButt.clicked.connect(self.accept)
        self.noButt.clicked.connect(self.reject)
        
        self.setLayout(self.vBoxSizer)
        self.setWindowTitle(self.tr("Warning"))
        self.show()
Пример #6
0
    def __init__(self, parent):
        QDialog.__init__(self, parent, Qt.Dialog)
        self.setWindowTitle(self.tr("Language Manager"))
        self.resize(700, 500)

        vbox = QVBoxLayout(self)
        self._tabs = QTabWidget()
        vbox.addWidget(self._tabs)
        # Footer
        hbox = QHBoxLayout()
        btn_close = QPushButton(self.tr('Close'))
        btnReload = QPushButton(self.tr("Reload"))
        hbox.addWidget(btn_close)
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(btnReload)
        vbox.addLayout(hbox)
        self.overlay = ui_tools.Overlay(self)
        self.overlay.show()

        self._languages = []
        self._loading = True
        self.downloadItems = []

        #Load Themes with Thread
        self.connect(btnReload, SIGNAL("clicked()"), self._reload_languages)
        self._thread = ui_tools.ThreadExecution(self.execute_thread)
        self.connect(self._thread, SIGNAL("finished()"),
                     self.load_languages_data)
        self.connect(btn_close, SIGNAL('clicked()'), self.close)
        self._reload_languages()
Пример #7
0
    def __init__(self):
        super(MigrationWidget, self).__init__()
        self._migration = {}
        vbox = QVBoxLayout(self)
        lbl_title = QLabel(self.tr("Current code:"))
        self.current_list = QListWidget()
        lbl_suggestion = QLabel(self.tr("Suggested changes:"))
        self.suggestion = QPlainTextEdit()
        self.suggestion.setReadOnly(True)

        self.btn_apply = QPushButton(self.tr("Apply change!"))
        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox.addWidget(self.btn_apply)

        vbox.addWidget(lbl_title)
        vbox.addWidget(self.current_list)
        vbox.addWidget(lbl_suggestion)
        vbox.addWidget(self.suggestion)
        vbox.addLayout(hbox)

        self.connect(self.current_list,
                     SIGNAL("itemClicked(QListWidgetItem*)"),
                     self.load_suggestion)
        self.connect(self.btn_apply, SIGNAL("clicked()"), self.apply_changes)
Пример #8
0
    def initAppletDrawerUi(self):
        training_controls = EdgeTrainingGui.createDrawerControls(self)
        training_controls.layout().setContentsMargins(5, 0, 5, 0)
        training_layout = QVBoxLayout()
        training_layout.addWidget(training_controls)
        training_layout.setContentsMargins(0, 0, 0, 0)
        training_box = QGroupBox("Training", parent=self)
        training_box.setLayout(training_layout)
        training_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        multicut_controls = MulticutGuiMixin.createDrawerControls(self)
        multicut_controls.layout().setContentsMargins(5, 0, 5, 0)
        multicut_layout = QVBoxLayout()
        multicut_layout.addWidget(multicut_controls)
        multicut_layout.setContentsMargins(0, 0, 0, 0)
        multicut_box = QGroupBox("Multicut", parent=self)
        multicut_box.setLayout(multicut_layout)
        multicut_box.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)

        drawer_layout = QVBoxLayout()
        drawer_layout.addWidget(training_box)
        drawer_layout.addWidget(multicut_box)
        drawer_layout.setSpacing(2)
        drawer_layout.setContentsMargins(5, 5, 5, 5)
        drawer_layout.addSpacerItem(
            QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding))

        self._drawer = QWidget(parent=self)
        self._drawer.setLayout(drawer_layout)
Пример #9
0
    def __init__(self, parent):
        QDialog.__init__(self, parent)
        self.resize(600, 375)
        self.gridLayout = QGridLayout(self)
        self.gridLayout.setMargin(0)
        self.gridLayout.setSpacing(0)
        self.treeWidget = QTreeWidget(self)
        self.treeWidget.setMaximumSize(200, 1500)

        self.virux = QTreeWidgetItem(self.treeWidget)
        self.virux.setExpanded(True)
        icon = QIcon()
        icon.addPixmap(QPixmap("data/logo.png"), QIcon.Normal, QIcon.On)
        self.virux.setIcon(0, icon)
        item_1 = QTreeWidgetItem(self.virux)
        item_1 = QTreeWidgetItem(self.virux)
        self.dialog = QTreeWidgetItem(self.treeWidget)
        self.dialog.setExpanded(True)
        item_1 = QTreeWidgetItem(self.dialog)
        item_1 = QTreeWidgetItem(self.dialog)
        self.treeWidget.header().setVisible(False)

        self.gridLayout.addWidget(self.treeWidget, 0, 0, 1, 1)
        self.groupBox = QGroupBox(self)
        self.groupBox.setFlat(True)

        self.gridLayout_3 = QGridLayout(self.groupBox)
        self.gridLayout_3.setMargin(0)
        self.gridLayout_3.setSpacing(0)
        self.widget = QWidget(self.groupBox)
        self.gridLayout_4 = QGridLayout(self.widget)
        self.gridLayout_4.setMargin(0)
        self.gridLayout_4.setSpacing(0)
        self.gridLayout_4.setMargin(0)
        spacerItem = QSpacerItem(300, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)
        self.gridLayout_4.addItem(spacerItem, 0, 0, 1, 1)
        self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1)
        self.gridLayout.addWidget(self.groupBox, 0, 1, 1, 1)
        self.pButton = QPushButton(self)
        self.pButton.setText("asd")
        self.pButton.setDefault(True)
        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.addButton(self.pButton, QDialogButtonBox.AcceptRole)
        #self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 2)

        self.setWindowTitle("Virux Ayarlar")
        self.treeWidget.headerItem().setText(0, "")
        self.treeWidget.topLevelItem(0).setText(0, u"Virux")
        self.treeWidget.topLevelItem(0).child(0).setText(0, u"Virux1")
        self.treeWidget.topLevelItem(0).child(1).setText(0, u"Virux2")
        self.treeWidget.topLevelItem(1).setText(0, u"Dialog")
        self.treeWidget.topLevelItem(1).child(0).setText(0, u"Dialog1")
        self.treeWidget.topLevelItem(1).child(1).setText(0, u"Dialog2")
        self.groupBox.setTitle(u"GroupBox")
        self.groupYaz()

        self.treeWidget.itemPressed.connect(self.lale)
Пример #10
0
    def __init__(self, parent):
        QWidget.__init__(self, parent)
        self._main_container = main_container.MainContainer()
        self._explorer_container = explorer_container.ExplorerContainer()
        self._result_widget = FindInFilesResult()
        self._open_find_button = QPushButton(self.tr("Find!"))
        self._stop_button = QPushButton(self.tr("Stop"))
        self._clear_button = QPushButton(self.tr("Clear!"))
        self._replace_button = QPushButton(self.tr("Replace"))
        self._find_widget = FindInFilesDialog(self._result_widget, self)
        self._error_label = QLabel(self.tr("No Results"))
        self._error_label.setVisible(False)
        #Replace Area
        self.replace_widget = QWidget()
        hbox_replace = QHBoxLayout(self.replace_widget)
        hbox_replace.setContentsMargins(0, 0, 0, 0)
        self.lbl_replace = QLabel(self.tr("Replace results with:"))
        self.lbl_replace.setTextFormat(Qt.PlainText)
        self.replace_edit = QLineEdit()
        hbox_replace.addWidget(self.lbl_replace)
        hbox_replace.addWidget(self.replace_edit)
        self.replace_widget.setVisible(False)
        #Main Layout
        main_hbox = QHBoxLayout(self)
        #Result Layout
        tree_vbox = QVBoxLayout()
        tree_vbox.addWidget(self._result_widget)
        tree_vbox.addWidget(self._error_label)
        tree_vbox.addWidget(self.replace_widget)

        main_hbox.addLayout(tree_vbox)
        #Buttons Layout
        vbox = QVBoxLayout()
        vbox.addWidget(self._open_find_button)
        vbox.addWidget(self._stop_button)
        vbox.addWidget(self._clear_button)
        vbox.addSpacerItem(
            QSpacerItem(0, 50, QSizePolicy.Fixed, QSizePolicy.Expanding))
        vbox.addWidget(self._replace_button)
        main_hbox.addLayout(vbox)

        self._open_find_button.setFocus()
        #signals
        self.connect(self._open_find_button, SIGNAL("clicked()"), self.open)
        self.connect(self._stop_button, SIGNAL("clicked()"), self._find_stop)
        self.connect(self._clear_button, SIGNAL("clicked()"),
                     self._clear_results)
        self.connect(self._result_widget,
                     SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
                     self._go_to)
        self.connect(self._result_widget,
                     SIGNAL("itemClicked(QTreeWidgetItem *, int)"),
                     self._go_to)
        self.connect(self._find_widget, SIGNAL("finished()"),
                     self._find_finished)
        self.connect(self._find_widget, SIGNAL("findStarted()"),
                     self._find_started)
        self.connect(self._replace_button, SIGNAL("clicked()"),
                     self._replace_results)
Пример #11
0
    def __init__(self, parent):
        super(FindInFilesWidget, self).__init__(parent)
        self._main_container = IDE.get_service('main_container')
        self._explorer_container = IDE.get_service('explorer')
        self._result_widget = FindInFilesResult()
        self._open_find_button = QPushButton(translations.TR_FIND + "!")
        self._stop_button = QPushButton(translations.TR_STOP + "!")
        self._clear_button = QPushButton(translations.TR_CLEAR + "!")
        self._replace_button = QPushButton(translations.TR_REPLACE)
        self._find_widget = FindInFilesDialog(self._result_widget, self)
        self._error_label = QLabel(translations.TR_NO_RESULTS)
        self._error_label.setVisible(False)
        #Replace Area
        self.replace_widget = QWidget()
        hbox_replace = QHBoxLayout(self.replace_widget)
        hbox_replace.setContentsMargins(0, 0, 0, 0)
        self.lbl_replace = QLabel(translations.TR_REPLACE_RESULTS_WITH)
        self.lbl_replace.setTextFormat(Qt.PlainText)
        self.replace_edit = QLineEdit()
        hbox_replace.addWidget(self.lbl_replace)
        hbox_replace.addWidget(self.replace_edit)
        self.replace_widget.setVisible(False)
        #Main Layout
        main_hbox = QHBoxLayout(self)
        #Result Layout
        tree_vbox = QVBoxLayout()
        tree_vbox.addWidget(self._result_widget)
        tree_vbox.addWidget(self._error_label)
        tree_vbox.addWidget(self.replace_widget)

        main_hbox.addLayout(tree_vbox)
        #Buttons Layout
        vbox = QVBoxLayout()
        vbox.addWidget(self._open_find_button)
        vbox.addWidget(self._stop_button)
        vbox.addWidget(self._clear_button)
        vbox.addSpacerItem(
            QSpacerItem(0, 50, QSizePolicy.Fixed, QSizePolicy.Expanding))
        vbox.addWidget(self._replace_button)
        main_hbox.addLayout(vbox)

        self._open_find_button.setFocus()
        #signals
        self.connect(self._open_find_button, SIGNAL("clicked()"), self.open)
        self.connect(self._stop_button, SIGNAL("clicked()"), self._find_stop)
        self.connect(self._clear_button, SIGNAL("clicked()"),
                     self._clear_results)
        self.connect(self._result_widget,
                     SIGNAL("itemActivated(QTreeWidgetItem *, int)"),
                     self._go_to)
        self.connect(self._result_widget,
                     SIGNAL("itemClicked(QTreeWidgetItem *, int)"),
                     self._go_to)
        self.connect(self._find_widget, SIGNAL("finished()"),
                     self._find_finished)
        self.connect(self._find_widget, SIGNAL("findStarted()"),
                     self._find_started)
        self.connect(self._replace_button, SIGNAL("clicked()"),
                     self._replace_results)
Пример #12
0
    def initAppletDrawerUi(self):
        localDir = os.path.split(__file__)[0]
        self._drawer = self._cropControlUi

        data_has_z_axis = True
        if self.topLevelOperatorView.InputImage.ready():
            tShape = self.topLevelOperatorView.InputImage.meta.getTaggedShape()
            if not 'z' in tShape or tShape['z']==1:
                data_has_z_axis = False

        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSliderZ.setVisible(data_has_z_axis)
        self._cropControlUi._minSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi._maxSpinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMinZ.setVisible(data_has_z_axis)
        self._cropControlUi.labelMaxZ.setVisible(data_has_z_axis)

        self._cropControlUi.AddCropButton.clicked.connect( bind (self.newCrop) )
        self._cropControlUi.SetCropButton.clicked.connect( bind (self.setCrop) )

        self.topLevelOperatorView.MinValueT.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueT.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueX.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueX.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueY.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueY.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MinValueZ.notifyDirty(self.apply_operator_settings_to_gui)
        self.topLevelOperatorView.MaxValueZ.notifyDirty(self.apply_operator_settings_to_gui)

        self.topLevelOperatorView.InputImage.notifyDirty(self.setDefaultValues)
        self.topLevelOperatorView.PredictionImage.notifyDirty(self.setDefaultValues)

        layout = QVBoxLayout()
        layout.setSpacing(0)
        layout.addWidget( self._cropControlUi )
        layout.addSpacerItem( QSpacerItem(0,0,vPolicy=QSizePolicy.Expanding) )

        self.setDefaultValues()
        self.apply_operator_settings_to_gui()

        self.editor.showCropLines(True)
        self.editor.cropModel.setEditable (True)
        self.editor.cropModel.changed.connect(self.onCropModelChanged)
        self.editor.posModel.timeChanged.connect(self.updateTime)
        self._cropControlUi._minSliderT.valueChanged.connect(self._onMinSliderTMoved)
        self._cropControlUi._maxSliderT.valueChanged.connect(self._onMaxSliderTMoved)
        self._cropControlUi._minSliderX.valueChanged.connect(self._onMinSliderXMoved)
        self._cropControlUi._maxSliderX.valueChanged.connect(self._onMaxSliderXMoved)
        self._cropControlUi._minSliderY.valueChanged.connect(self._onMinSliderYMoved)
        self._cropControlUi._maxSliderY.valueChanged.connect(self._onMaxSliderYMoved)
        self._cropControlUi._minSliderZ.valueChanged.connect(self._onMinSliderZMoved)
        self._cropControlUi._maxSliderZ.valueChanged.connect(self._onMaxSliderZMoved)

        self._cropControlUi.cropListView.deleteCrop.connect(self.onDeleteCrop)
        self._cropControlUi.cropListView.colorsChanged.connect(self.onColorsChanged)

        self._initCropListView()
Пример #13
0
    def __init__(self, parent):
        super(EditorCompletion, self).__init__()
        vbox = QVBoxLayout(self)

        groupBoxClose = QGroupBox(translations.TR_PREF_EDITOR_COMPLETE)
        formClose = QGridLayout(groupBoxClose)
        formClose.setContentsMargins(5, 15, 5, 5)
        self._checkParentheses = QCheckBox(
            translations.TR_PREF_EDITOR_PARENTHESES + " ()")
        self._checkParentheses.setChecked('(' in settings.BRACES)
        self._checkKeys = QCheckBox(translations.TR_PREF_EDITOR_KEYS + " {}")
        self._checkKeys.setChecked('{' in settings.BRACES)
        self._checkBrackets = QCheckBox(translations.TR_PREF_EDITOR_BRACKETS +
                                        " []")
        self._checkBrackets.setChecked('[' in settings.BRACES)
        self._checkSimpleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_SIMPLE_QUOTES)
        self._checkSimpleQuotes.setChecked("'" in settings.QUOTES)
        self._checkDoubleQuotes = QCheckBox(
            translations.TR_PREF_EDITOR_DOUBLE_QUOTES)
        self._checkDoubleQuotes.setChecked('"' in settings.QUOTES)
        self._checkCompleteDeclarations = QCheckBox(
            translations.TR_PREF_EDITOR_COMPLETE_DECLARATIONS.format(
                resources.get_shortcut("Complete-Declarations").toString(
                    QKeySequence.NativeText)))
        self._checkCompleteDeclarations.setChecked(
            settings.COMPLETE_DECLARATIONS)
        formClose.addWidget(self._checkParentheses,
                            1,
                            1,
                            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkKeys, 1, 2, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkBrackets, 2, 1, alignment=Qt.AlignTop)
        formClose.addWidget(self._checkSimpleQuotes,
                            2,
                            2,
                            alignment=Qt.AlignTop)
        formClose.addWidget(self._checkDoubleQuotes,
                            3,
                            1,
                            alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxClose)

        groupBoxCode = QGroupBox(translations.TR_PREF_EDITOR_CODE_COMPLETION)
        formCode = QGridLayout(groupBoxCode)
        formCode.setContentsMargins(5, 15, 5, 5)
        self._checkCodeDot = QCheckBox(
            translations.TR_PREF_EDITOR_ACTIVATE_COMPLETION)
        self._checkCodeDot.setChecked(settings.CODE_COMPLETION)
        formCode.addWidget(self._checkCompleteDeclarations,
                           5,
                           1,
                           alignment=Qt.AlignTop)

        formCode.addWidget(self._checkCodeDot, 6, 1, alignment=Qt.AlignTop)
        vbox.addWidget(groupBoxCode)
        vbox.addItem(
            QSpacerItem(0, 10, QSizePolicy.Expanding, QSizePolicy.Expanding))
Пример #14
0
    def __init__(self, parent=None):
        super(ErrorsWidget, self).__init__(parent, Qt.WindowStaysOnTopHint)
        self.pep8 = None
        self._outRefresh = True

        vbox = QVBoxLayout(self)
        self.listErrors = QListWidget()
        self.listErrors.setSortingEnabled(True)
        self.listPep8 = QListWidget()
        self.listPep8.setSortingEnabled(True)
        hbox_lint = QHBoxLayout()
        if settings.FIND_ERRORS:
            self.btn_lint_activate = QPushButton(self.tr("Lint: ON"))
        else:
            self.btn_lint_activate = QPushButton(self.tr("Lint: OFF"))
        self.errorsLabel = QLabel(self.tr("Static Errors: %s") % 0)
        hbox_lint.addWidget(self.errorsLabel)
        hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox_lint.addWidget(self.btn_lint_activate)
        vbox.addLayout(hbox_lint)
        vbox.addWidget(self.listErrors)
        hbox_pep8 = QHBoxLayout()
        if settings.CHECK_STYLE:
            self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON"))
        else:
            self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF"))
        self.pep8Label = QLabel(self.tr("PEP8 Errors: %s") % 0)
        hbox_pep8.addWidget(self.pep8Label)
        hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox_pep8.addWidget(self.btn_pep8_activate)
        vbox.addLayout(hbox_pep8)
        vbox.addWidget(self.listPep8)

        self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"),
                     self.errors_selected)
        self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"),
                     self.pep8_selected)
        self.connect(self.btn_lint_activate, SIGNAL("clicked()"),
                     self._turn_on_off_lint)
        self.connect(self.btn_pep8_activate, SIGNAL("clicked()"),
                     self._turn_on_off_pep8)

        IDE.register_service('tab_errors', self)
        ExplorerContainer.register_tab(translations.TR_TAB_ERRORS, self)
Пример #15
0
    def createDrawerControls(self):
        op = self.topLevelOperatorView

        def configure_update_handlers( qt_signal, op_slot ):
            qt_signal.connect( self.configure_operator_from_gui )
            cleanup_fn = op_slot.notifyDirty( self.configure_gui_from_operator, defer=True )
            self.__cleanup_fns.append( cleanup_fn )

        # Controls
        feature_selection_button = QPushButton(text="Select Features",
                                               icon=QIcon(ilastikIcons.AddSel),
                                               toolTip="Select edge/superpixel features to use for classification.",
                                               clicked=self._open_feature_selection_dlg)
        self.train_from_gt_button = QPushButton(text="Auto-label",
                                                icon=QIcon(ilastikIcons.Segment),
                                                toolTip="Automatically label all edges according to your pre-loaded groundtruth volume.",
                                                clicked=self._handle_label_from_gt_clicked)
        self.clear_labels_button = QPushButton(text="Clear Labels",
                                               icon=QIcon(ilastikIcons.Clear),
                                               toolTip="Remove all edge labels. (Start over on this image.)",
                                               clicked=self._handle_clear_labels_clicked)
        self.live_update_button = QPushButton(text="Live Predict",
                                              checkable=True,
                                              icon=QIcon(ilastikIcons.Play))
        configure_update_handlers( self.live_update_button.toggled, op.FreezeCache )
        
        # Layout
        label_layout = QHBoxLayout()
        label_layout.addWidget(self.clear_labels_button)
        label_layout.addWidget(self.train_from_gt_button)
        label_layout.setSpacing(1)
        
        layout = QVBoxLayout()
        layout.addWidget(feature_selection_button)
        layout.setSpacing(1)
        layout.addLayout(label_layout)
        layout.addWidget(self.live_update_button)
        layout.addSpacerItem( QSpacerItem(0, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) )
        
        # Finally, the whole drawer widget
        drawer = QWidget(parent=self)
        drawer.setLayout(layout)

        # Widget Shortcuts
        mgr = ShortcutManager()
        ActionInfo = ShortcutManager.ActionInfo
        shortcut_group = "Edge Training"
        mgr.register( "l", ActionInfo( shortcut_group,
                                       "Live Predict",
                                       "Toggle live edge classifier update mode",
                                       self.live_update_button.toggle,
                                       self.live_update_button,
                                       self.live_update_button ) )

        
        return drawer
Пример #16
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent, Qt.Dialog)
        self.setWindowTitle(self.tr("About NINJA-IDE"))
        self.setMaximumSize(QSize(0, 0))

        vbox = QVBoxLayout(self)

        #Create an icon for the Dialog
        pixmap = QPixmap(":img/icon")
        self.lblIcon = QLabel()
        self.lblIcon.setPixmap(pixmap)

        hbox = QHBoxLayout()
        hbox.addWidget(self.lblIcon)

        lblTitle = QLabel(
            '<h1>NINJA-IDE</h1>\n<i>Ninja-IDE Is Not Just Another IDE<i>')
        lblTitle.setTextFormat(Qt.RichText)
        lblTitle.setAlignment(Qt.AlignLeft)
        hbox.addWidget(lblTitle)
        vbox.addLayout(hbox)
        #Add description
        vbox.addWidget(
            QLabel(
                self.tr(
                    """NINJA-IDE (from: "Ninja Is Not Just Another IDE"), is a
cross-platform integrated development environment specifically
designed to build Python Applications.

NINJA-IDE provides the tools necessary to simplify the
Python software development process and handles all kinds of
situations thanks to its rich extensibility.""")))
        vbox.addWidget(QLabel(self.tr("Version: %s") % ninja_ide.__version__))
        link_ninja = QLabel(
            self.tr('Website: <a href="%s"><span style=" '
                    'text-decoration: underline; color:#ff9e21;">'
                    '%s</span></a>') % (ninja_ide.__url__, ninja_ide.__url__))
        vbox.addWidget(link_ninja)
        link_source = QLabel(
            self.tr(
                'Source Code: <a href="%s"><span style=" '
                'text-decoration: underline; color:#ff9e21;">%s</span></a>') %
            (ninja_ide.__source__, ninja_ide.__source__))
        vbox.addWidget(link_source)

        hbox2 = QHBoxLayout()
        hbox2.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        btn_close = QPushButton(translations.TR_CLOSE)
        hbox2.addWidget(btn_close)
        vbox.addLayout(hbox2)

        self.connect(link_ninja, SIGNAL("linkActivated(QString)"),
                     self.link_activated)
        self.connect(link_source, SIGNAL("linkActivated(QString)"),
                     self.link_activated)
        self.connect(btn_close, SIGNAL("clicked()"), self.close)
Пример #17
0
    def setMenu(self):
        self.menuLayout = QHBoxLayout()
        self.hboxLayout.addLayout(self.menuLayout)
        self.pageLineEdit = PageLineEdit()
        self.pageLineEdit.setEnabled(False)
        self.menuLayout.addLayout(self.pageLineEdit)

        spacer = QSpacerItem(20, 20, QSizePolicy.Expanding,
                             QSizePolicy.Minimum)
        self.menuLayout.addItem(spacer)

        self.searchLayout = QHBoxLayout()
        self.menuLayout.addLayout(self.searchLayout)
        self.searchLabel = QLabel(self.tr("Search:"))
        self.searchLabel.setTextFormat(Qt.AutoText)
        self.searchLayout.addWidget(self.searchLabel)
        self.searchLineEdit = QLineEdit()
        self.searchLineEdit.setEnabled(False)
        self.searchLabel.setBuddy(self.searchLineEdit)
        self.searchLayout.addWidget(self.searchLineEdit)
        self.searchComboBox = QComboBox()
        self.searchComboBox.setEnabled(False)
        self.searchComboBox.insertItems(0, ["Forwards", "Backwards"])
        self.searchLayout.addWidget(self.searchComboBox)
        self.findButton = QPushButton("Find")
        self.findButton.setEnabled(False)
        self.searchLayout.addWidget(self.findButton)
        self.clearButton = QPushButton("Clear")
        self.clearButton.setEnabled(False)
        self.searchLayout.addWidget(self.clearButton)

        spacer = QSpacerItem(20, 20, QSizePolicy.Expanding,
                             QSizePolicy.Minimum)
        self.menuLayout.addItem(spacer)

        self.scaleLabel = QLabel("Scale:")
        self.menuLayout.addWidget(self.scaleLabel)
        self.scaleComboBox = QComboBox()
        self.scaleComboBox.setEnabled(False)
        self.scaleComboBox.insertItems(0, self.scalePercents)
        self.scaleComboBox.setCurrentIndex(3)
        self.scaleLabel.setBuddy(self.scaleComboBox)
        self.menuLayout.addWidget(self.scaleComboBox)
Пример #18
0
 def _setupUi(self):
     self.setWindowTitle(tr("Enter your registration key"))
     self.resize(365, 126)
     self.verticalLayout = QVBoxLayout(self)
     self.promptLabel = QLabel(self)
     appname = str(QCoreApplication.instance().applicationName())
     prompt = tr("Type the key you received when you contributed to $appname, as well as the "
         "e-mail used as a reference for the purchase.").replace('$appname', appname)
     self.promptLabel.setText(prompt)
     self.promptLabel.setAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
     self.promptLabel.setWordWrap(True)
     self.verticalLayout.addWidget(self.promptLabel)
     self.formLayout = QFormLayout()
     self.formLayout.setSizeConstraint(QLayout.SetNoConstraint)
     self.formLayout.setFieldGrowthPolicy(QFormLayout.ExpandingFieldsGrow)
     self.formLayout.setLabelAlignment(Qt.AlignRight|Qt.AlignTrailing|Qt.AlignVCenter)
     self.formLayout.setFormAlignment(Qt.AlignLeading|Qt.AlignLeft|Qt.AlignTop)
     self.label2 = QLabel(self)
     self.label2.setText(tr("Registration key:"))
     self.formLayout.setWidget(0, QFormLayout.LabelRole, self.label2)
     self.label3 = QLabel(self)
     self.label3.setText(tr("Registered e-mail:"))
     self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label3)
     self.codeEdit = QLineEdit(self)
     self.formLayout.setWidget(0, QFormLayout.FieldRole, self.codeEdit)
     self.emailEdit = QLineEdit(self)
     self.formLayout.setWidget(1, QFormLayout.FieldRole, self.emailEdit)
     self.verticalLayout.addLayout(self.formLayout)
     self.horizontalLayout = QHBoxLayout()
     self.contributeButton = QPushButton(self)
     self.contributeButton.setText(tr("Contribute"))
     self.contributeButton.setAutoDefault(False)
     self.horizontalLayout.addWidget(self.contributeButton)
     spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
     self.horizontalLayout.addItem(spacerItem)
     self.cancelButton = QPushButton(self)
     sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.cancelButton.sizePolicy().hasHeightForWidth())
     self.cancelButton.setSizePolicy(sizePolicy)
     self.cancelButton.setText(tr("Cancel"))
     self.cancelButton.setAutoDefault(False)
     self.horizontalLayout.addWidget(self.cancelButton)
     self.submitButton = QPushButton(self)
     sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
     sizePolicy.setHorizontalStretch(0)
     sizePolicy.setVerticalStretch(0)
     sizePolicy.setHeightForWidth(self.submitButton.sizePolicy().hasHeightForWidth())
     self.submitButton.setSizePolicy(sizePolicy)
     self.submitButton.setText(tr("Submit"))
     self.submitButton.setAutoDefault(False)
     self.submitButton.setDefault(True)
     self.horizontalLayout.addWidget(self.submitButton)
     self.verticalLayout.addLayout(self.horizontalLayout)
Пример #19
0
    def __init__(self, *args, **kwargs):
        super(ShortcutManagerDlg, self).__init__(*args, **kwargs)
        self.setWindowTitle("Shortcut Preferences")
        self.setMinimumWidth(500)

        mgr = ShortcutManager()  # Singleton

        tempLayout = QVBoxLayout()

        # Create a LineEdit for each shortcut,
        # and keep track of them in a dict
        shortcutEdits = dict()
        for group, shortcutDict in mgr.shortcuts.items():
            grpBox = QGroupBox(group)
            l = QGridLayout(self)
            for i, (shortcut, (desc, obj)) in enumerate(shortcutDict.items()):
                l.addWidget(QLabel(desc), i, 0)
                edit = QLineEdit(str(shortcut.key().toString()))
                l.addWidget(edit, i, 1)
                shortcutEdits[shortcut] = edit
            grpBox.setLayout(l)
            tempLayout.addWidget(grpBox)

        # Add ok and cancel buttons
        buttonLayout = QHBoxLayout()
        cancelButton = QPushButton("Cancel")
        cancelButton.clicked.connect(self.reject)
        okButton = QPushButton("OK")
        okButton.clicked.connect(self.accept)
        okButton.setDefault(True)
        buttonLayout.addSpacerItem(QSpacerItem(10, 0))
        buttonLayout.addWidget(cancelButton)
        buttonLayout.addWidget(okButton)
        tempLayout.addLayout(buttonLayout)

        self.setLayout(tempLayout)

        # Show the window
        result = self.exec_()

        # If the user didn't hit "cancel", apply his changes to the manager's shortcuts
        if result == QDialog.Accepted:
            for shortcut, edit in shortcutEdits.items():
                oldKey = shortcut.key()
                newKey = str(edit.text())
                shortcut.setKey(QKeySequence(newKey))

                # If the user typed an invalid shortcut, then keep the old value
                if shortcut.key().isEmpty():
                    shortcut.setKey(oldKey)

                # Make sure the tooltips get updated.
                mgr.updateToolTip(shortcut)

            mgr.storeToPreferences()
Пример #20
0
    def __init__(self, parent):
        super(ThemeEditor, self).__init__(parent, Qt.Dialog)
        vbox = QVBoxLayout(self)

        hbox = QHBoxLayout()
        self.line_name = QLineEdit()
        self.btn_save = QPushButton(translations.TR_SAVE)
        self.line_name.setPlaceholderText(getuser().capitalize() + "s_theme")
        hbox.addWidget(self.line_name)
        hbox.addWidget(self.btn_save)

        self.edit_qss = QPlainTextEdit()
        css = 'QPlainTextEdit {color: %s; background-color: %s;' \
            'selection-color: %s; selection-background-color: %s;}' \
            % (resources.CUSTOM_SCHEME.get(
                'editor-text', resources.COLOR_SCHEME['Default']),
                resources.CUSTOM_SCHEME.get(
                    'EditorBackground',
                    resources.COLOR_SCHEME['EditorBackground']),
                resources.CUSTOM_SCHEME.get(
                    'EditorSelectionColor',
                    resources.COLOR_SCHEME['EditorSelectionColor']),
                resources.CUSTOM_SCHEME.get(
                    'EditorSelectionBackground',
                    resources.COLOR_SCHEME['EditorSelectionBackground']))
        self.edit_qss.setStyleSheet(css)

        self.btn_apply = QPushButton(self.tr("Apply Style Sheet"))
        hbox2 = QHBoxLayout()
        hbox2.addSpacerItem(
            QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))
        hbox2.addWidget(self.btn_apply)
        hbox2.addSpacerItem(
            QSpacerItem(10, 0, QSizePolicy.Expanding, QSizePolicy.Fixed))

        vbox.addWidget(self.edit_qss)
        vbox.addLayout(hbox)
        vbox.addLayout(hbox2)

        self.connect(self.btn_apply, SIGNAL("clicked()"),
                     self.apply_stylesheet)
        self.connect(self.btn_save, SIGNAL("clicked()"), self.save_stylesheet)
Пример #21
0
    def __init__(self, parent, altitudeUnit=AltitudeUnits.FT):
        QWidget.__init__(self, parent)
        while not isinstance(parent, QDialog):
            parent = parent.parent()
        self.setObjectName("MCAHPanel" +
                           str(len(parent.findChildren(MCAHPanel))))

        sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
        self.setSizePolicy(sizePolicy)

        self.hLayout = QHBoxLayout(self)
        self.hLayout.setSpacing(0)
        self.hLayout.setMargin(0)
        self.hLayout.setObjectName("hLayout")

        self.basicFrame = Frame(self, "HL")
        self.basicFrame.Spacing = 0
        self.hLayout.addWidget(self.basicFrame)

        self.lblMCAH = QLabel(self.basicFrame)
        self.lblMCAH.setMinimumSize(QSize(250, 0))
        font = QFont()
        font.setWeight(50)
        font.setBold(False)
        self.lblMCAH.setFont(font)
        self.lblMCAH.setObjectName(("lblMCAH"))
        self.basicFrame.Add = self.lblMCAH
        self.cmbMCAH = QComboBox(self.basicFrame)
        font = QFont()
        font.setWeight(50)
        font.setBold(False)
        self.cmbMCAH.setFont(font)
        self.cmbMCAH.setObjectName(self.objectName() + "_cmbMCAH")
        self.basicFrame.Add = self.cmbMCAH
        self.txtMCAH = QLineEdit(self.basicFrame)
        font = QFont()
        font.setWeight(50)
        font.setBold(False)
        self.txtMCAH.setFont(font)
        self.txtMCAH.setObjectName(self.objectName() + "_txtMCAH")
        self.txtMCAH.setMinimumWidth(70)
        self.txtMCAH.setMaximumWidth(70)
        self.basicFrame.Add = self.txtMCAH
        self.setLayout(self.hLayout)

        spacerItem = QSpacerItem(0, 10, QSizePolicy.Minimum,
                                 QSizePolicy.Minimum)
        self.hLayout.addItem(spacerItem)
        self.cmbMCAH.addItems([MCAHType.MCA, MCAHType.MCH])
        #         self.txtMCAH.textChanged.connect(self.txtAltitude_TextChanged)
        self.altitudeUnit = altitudeUnit
Пример #22
0
    def __init__(self, parent=None):
        super(ExploreDataWidget, self).__init__(parent)
        self.setStyleSheet(OfSs.dock_style)
        # Create geometry
        self.setObjectName("ExploreData")
        self.setWindowTitle("ExploreData")
        self.dockWidgetContents = QWidget()

        self.data_label = QLabel("Data", self.dockWidgetContents)

        self.add_btn = QPushButton(u"Ajouter variable",
                                   self.dockWidgetContents)
        self.remove_btn = QPushButton(u"Retirer variable",
                                      self.dockWidgetContents)
        self.datatables_choices = []
        self.datatable_combo = MyComboBox(self.dockWidgetContents,
                                          u'Choix de la table',
                                          self.datatables_choices)

        #        self.add_btn.setDisabled(True)
        #        self.remove_btn.setDisabled(True)

        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding,
                                 QSizePolicy.Minimum)

        horizontalLayout = QHBoxLayout()
        horizontalLayout.addWidget(self.add_btn)
        horizontalLayout.addWidget(self.remove_btn)
        horizontalLayout.addWidget(self.datatable_combo)
        horizontalLayout.addItem(spacerItem)
        self.view = DataFrameViewWidget(self.dockWidgetContents)

        verticalLayout = QVBoxLayout(self.dockWidgetContents)
        verticalLayout.addWidget(self.data_label)

        verticalLayout.addLayout(horizontalLayout)
        verticalLayout.addWidget(self.view)
        self.setWidget(self.dockWidgetContents)

        # Initialize attributes
        self.parent = parent

        self.selected_vars = set()
        self.data = DataFrame()
        self.view_data = None
        self.dataframes = {}
        self.vars = set()

        self.connect(self.add_btn, SIGNAL('clicked()'), self.add_var)
        self.connect(self.remove_btn, SIGNAL('clicked()'), self.remove_var)
        self.connect(self.datatable_combo.box,
                     SIGNAL('currentIndexChanged(int)'), self.select_data)

        self.update_btns()
Пример #23
0
    def __init__(self, parent = None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(_("Downloading"))

        # Top level fixed size dialog
        self.setWindowModality(Qt.WindowModal)

        self.__page_ = QLabel(self)
        self.__progress_ = QLabel(self)
        self.__cancel_ = QPushButton(self)
        self.__downloaded_ = 0
        self.__nbr_pages_ = 0

        vboxlayout = QVBoxLayout(self)

        # Page status
        labellayout = QHBoxLayout()
        labellayout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        labellayout.addWidget(self.__page_)
        labellayout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        vboxlayout.addLayout(labellayout)

        # Progress status
        progresslayout = QHBoxLayout()
        progresslayout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        progresslayout.addWidget(self.__progress_)
        progresslayout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        vboxlayout.addLayout(progresslayout)

        # Cancel button
        cancellayout = QHBoxLayout()
        cancellayout.addItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
        cancellayout.addWidget(self.__cancel_)
        vboxlayout.addLayout(cancellayout)

        self.__cancel_.setDefault(True)
        self.__cancel_.setText("Cancel")
        QObject.connect(self.__cancel_, SIGNAL("clicked()"),
                        self.__ui_progress_canceled_)
        QObject.connect(self, SIGNAL("rejected()"),
                        self.__ui_progress_canceled_)
Пример #24
0
    def __init__(self):
        QWidget.__init__(self)
        self.pep8 = None
        self._outRefresh = True

        vbox = QVBoxLayout(self)
        self.listErrors = QListWidget()
        self.listErrors.setSortingEnabled(True)
        self.listPep8 = QListWidget()
        self.listPep8.setSortingEnabled(True)
        hbox_lint = QHBoxLayout()
        if settings.FIND_ERRORS:
            self.btn_lint_activate = QPushButton(self.tr("Lint: ON"))
        else:
            self.btn_lint_activate = QPushButton(self.tr("Lint: OFF"))
        self.errorsLabel = QLabel(self.tr("Static Errors: %s") % 0)
        hbox_lint.addWidget(self.errorsLabel)
        hbox_lint.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox_lint.addWidget(self.btn_lint_activate)
        vbox.addLayout(hbox_lint)
        vbox.addWidget(self.listErrors)
        hbox_pep8 = QHBoxLayout()
        if settings.CHECK_STYLE:
            self.btn_pep8_activate = QPushButton(self.tr("PEP8: ON"))
        else:
            self.btn_pep8_activate = QPushButton(self.tr("PEP8: OFF"))
        self.pep8Label = QLabel(self.tr("PEP8 Errors: %s") % 0)
        hbox_pep8.addWidget(self.pep8Label)
        hbox_pep8.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        hbox_pep8.addWidget(self.btn_pep8_activate)
        vbox.addLayout(hbox_pep8)
        vbox.addWidget(self.listPep8)

        self.connect(self.listErrors, SIGNAL("itemSelectionChanged()"),
                     self.errors_selected)
        self.connect(self.listPep8, SIGNAL("itemSelectionChanged()"),
                     self.pep8_selected)
        self.connect(self.btn_lint_activate, SIGNAL("clicked()"),
                     self._turn_on_off_lint)
        self.connect(self.btn_pep8_activate, SIGNAL("clicked()"),
                     self._turn_on_off_pep8)
Пример #25
0
 def _setupPreferenceWidgets(self):
     scanTypeLabels = [
         tr("Filename"),
         tr("Filename - Fields"),
         tr("Filename - Fields (No Order)"),
         tr("Tags"),
         tr("Contents"),
         tr("Audio Contents"),
     ]
     self._setupScanTypeBox(scanTypeLabels)
     self._setupFilterHardnessBox()
     self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
     self.widget = QWidget(self)
     self.widget.setMinimumSize(QSize(0, 40))
     self.verticalLayout_4 = QVBoxLayout(self.widget)
     self.verticalLayout_4.setSpacing(0)
     self.verticalLayout_4.setMargin(0)
     self.label_6 = QLabel(self.widget)
     self.label_6.setText(tr("Tags to scan:"))
     self.verticalLayout_4.addWidget(self.label_6)
     self.horizontalLayout_2 = QHBoxLayout()
     self.horizontalLayout_2.setSpacing(0)
     spacerItem1 = QSpacerItem(15, 20, QSizePolicy.Fixed, QSizePolicy.Minimum)
     self.horizontalLayout_2.addItem(spacerItem1)
     self._setupAddCheckbox('tagTrackBox', tr("Track"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagTrackBox)
     self._setupAddCheckbox('tagArtistBox', tr("Artist"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagArtistBox)
     self._setupAddCheckbox('tagAlbumBox', tr("Album"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagAlbumBox)
     self._setupAddCheckbox('tagTitleBox', tr("Title"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagTitleBox)
     self._setupAddCheckbox('tagGenreBox', tr("Genre"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagGenreBox)
     self._setupAddCheckbox('tagYearBox', tr("Year"), self.widget)
     self.horizontalLayout_2.addWidget(self.tagYearBox)
     self.verticalLayout_4.addLayout(self.horizontalLayout_2)
     self.widgetsVLayout.addWidget(self.widget)
     self._setupAddCheckbox('wordWeightingBox', tr("Word weighting"))
     self.widgetsVLayout.addWidget(self.wordWeightingBox)
     self._setupAddCheckbox('matchSimilarBox', tr("Match similar words"))
     self.widgetsVLayout.addWidget(self.matchSimilarBox)
     self._setupAddCheckbox('mixFileKindBox', tr("Can mix file kind"))
     self.widgetsVLayout.addWidget(self.mixFileKindBox)
     self._setupAddCheckbox('useRegexpBox', tr("Use regular expressions when filtering"))
     self.widgetsVLayout.addWidget(self.useRegexpBox)
     self._setupAddCheckbox('removeEmptyFoldersBox', tr("Remove empty folders on delete or move"))
     self.widgetsVLayout.addWidget(self.removeEmptyFoldersBox)
     self._setupAddCheckbox('ignoreHardlinkMatches', tr("Ignore duplicates hardlinking to the same file"))
     self.widgetsVLayout.addWidget(self.ignoreHardlinkMatches)
     self._setupAddCheckbox('debugModeBox', tr("Debug mode (restart required)"))
     self.widgetsVLayout.addWidget(self.debugModeBox)
     self._setupBottomPart()
Пример #26
0
    def __init__(self, parent):
        super(ManualInstallWidget, self).__init__()
        self._parent = parent
        vbox = QVBoxLayout(self)
        form = QFormLayout()
        self._txtName = QLineEdit()
        self._txtName.setPlaceholderText('my_plugin')
        self._txtVersion = QLineEdit()
        self._txtVersion.setPlaceholderText('0.1')
        form.addRow(translations.TR_PROJECT_NAME, self._txtName)
        form.addRow(translations.TR_VERSION, self._txtVersion)
        vbox.addLayout(form)
        hPath = QHBoxLayout()
        self._txtFilePath = QLineEdit()
        self._txtFilePath.setPlaceholderText(
            os.path.join(os.path.expanduser('~'), 'full', 'path', 'to',
                         'plugin.zip'))
        self._btnFilePath = QPushButton(QIcon(":img/open"), '')
        self.completer, self.dirs = QCompleter(self), QDirModel(self)
        self.dirs.setFilter(QDir.AllEntries | QDir.NoDotAndDotDot)
        self.completer.setModel(self.dirs)
        self._txtFilePath.setCompleter(self.completer)
        hPath.addWidget(QLabel(translations.TR_FILENAME))
        hPath.addWidget(self._txtFilePath)
        hPath.addWidget(self._btnFilePath)
        vbox.addLayout(hPath)
        vbox.addSpacerItem(
            QSpacerItem(0, 1, QSizePolicy.Expanding, QSizePolicy.Expanding))

        hbox = QHBoxLayout()
        hbox.addSpacerItem(QSpacerItem(1, 0, QSizePolicy.Expanding))
        self._btnInstall = QPushButton(translations.TR_INSTALL)
        hbox.addWidget(self._btnInstall)
        vbox.addLayout(hbox)

        # Signals
        self.connect(self._btnFilePath, SIGNAL("clicked()"),
                     self._load_plugin_path)
        self.connect(self._btnInstall, SIGNAL("clicked()"),
                     self.install_plugin)
Пример #27
0
    def __init__(self):
        super(ControllerGui, self).__init__()
        self.setupUi(self)
        self.m_clear.clicked.connect(self.clear_plot)
        self.m_send.clicked.connect(self.send_start)
        self.m_stop.clicked.connect(self.send_stop)
        self.interface = SerialInterface()
        self.interface.received.connect(self.show_received)
        self.m_interval.setValidator(QIntValidator(0, 10000))
        self.m_interval.returnPressed.connect(self.send_start)

        brush = QBrush(QColor(255, 255, 255))

        box = QVBoxLayout(self.m_list)

        self.temperature_plot = PlotWidget(self)
        self.temperature_plot.setBackgroundBrush(brush)
        self.temperature_plot.setFixedHeight(300)
        box.addWidget(self.temperature_plot)
        self.temperature_curves = {}

        self.humidity_plot = PlotWidget(self)
        self.humidity_plot.setBackgroundBrush(brush)
        self.humidity_plot.setFixedHeight(300)
        box.addWidget(self.humidity_plot)
        self.humidity_curves = {}

        self.illumination_plot = PlotWidget(self)
        self.illumination_plot.setBackgroundBrush(brush)
        self.illumination_plot.setFixedHeight(300)
        box.addWidget(self.illumination_plot)
        self.illumination_curves = {}
        box.addItem(QSpacerItem(40, 20, QSizePolicy.Maximum, QSizePolicy.Expanding))
        self.m_list.setLayout(box)

        box = QVBoxLayout(self.m_devices)
        box.addItem(QSpacerItem(40, 20, QSizePolicy.Maximum, QSizePolicy.Expanding))
        self.m_devices.setLayout(box)
	self.file = open('result.txt', 'w')
Пример #28
0
 def _loadLogoWidget(self):
     """
     load logo widget
     """
     logoLayout = QHBoxLayout()
     self.imageLabel = QLabel()
     self.imageLabel.setPixmap(getpixmap("ui/images/Rosetta.png"))
     # Horizontal spacer
     hSpacer = QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Minimum)
     logoLayout.addItem(hSpacer)
     logoLayout.addWidget(self.imageLabel)
     logoLayout.addItem(hSpacer)
     return logoLayout
Пример #29
0
    def __init__(self, distributedObjects, parent=None):
        QWidget.__init__(self, parent, Qt.Tool | Qt.FramelessWindowHint)
        self.setPalette(QToolTip.palette())

        self.__do = distributedObjects
        self.__allowHide = True
        self.treeItemView = TreeItemView()
        self.treeItemView.setVerticalScrollMode(QAbstractItemView.ScrollPerItem)
        self.treeItemView.verticalScrollBar().rangeChanged.connect(self.resizeViewVertically)

        self.hide()

        self.exp = None

        addToWatchButton = QPushButton(Icons.watch, "")
        addToWatchButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToWatchButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToWatchButton.setToolTip("Add to Watch")
        addToWatchButton.clicked.connect(self.__addToWatch)
        addToDatagraphButton = QPushButton(Icons.datagraph, "")
        addToDatagraphButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToDatagraphButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        addToDatagraphButton.setToolTip("Add to Data Graph")
        addToDatagraphButton.clicked.connect(self.__addToDatagraph)
        setWatchpointButton = QPushButton(Icons.wp, "")
        setWatchpointButton.setMinimumSize(self.ICON_SIZE, self.ICON_SIZE)
        setWatchpointButton.setMaximumSize(self.ICON_SIZE, self.ICON_SIZE)
        setWatchpointButton.setToolTip("Set Watchpoint")
        setWatchpointButton.clicked.connect(self.__setWatchpoint)

        self.__layout = QHBoxLayout(self)
        self.__layout.addWidget(self.treeItemView)
        l = QVBoxLayout()
        l.addWidget(addToWatchButton)
        l.addWidget(addToDatagraphButton)
        l.addWidget(setWatchpointButton)
        l.addSpacerItem(QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding))
        # show a size grip in the corner to allow the user to resize the window
        l.addWidget(QSizeGrip(self))
        l.setSpacing(0)
        self.__layout.addLayout(l)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.__layout.setSpacing(0)

        self.__hideTimer = QTimer()
        self.__hideTimer.setSingleShot(True)
        self.__hideTimer.timeout.connect(self.hideNow)

        self.treeItemView.contextMenuOpen.connect(self.__setDisallowHide)
        self.treeItemView.setRootIsDecorated(False)
        self.treeItemView.setHeaderHidden(True)
Пример #30
0
    def __init__(self, parent=None, code=''):
        super(CodePastingDialog, self).__init__(parent)
        self.setWindowTitle(self.tr("Enviar a Pastebin"))
        self.setMinimumSize(700, 500)
        self._parent = parent
        container = QVBoxLayout(self)

        # Thread
        self.thread = code_pasting.Thread()
        self.connect(self.thread, SIGNAL("finished()"), self._paste_result)
        # Campos
        fields_box = QGridLayout()
        fields_box.addWidget(QLabel(self.tr("Expirar después de:")), 0, 0)
        self._spin_expire = QSpinBox()
        self._spin_expire.setSuffix(self.tr(" Días"))
        self._spin_expire.setMinimum(1)
        fields_box.addWidget(self._spin_expire, 0, 1)
        fields_box.addWidget(QLabel(self.tr("Acceso:")), 1, 0)
        self._combo_access = QComboBox()
        self._combo_access.addItems([self.tr("Público"), self.tr("Privado")])
        fields_box.addWidget(self._combo_access, 1, 1)
        fields_box.addWidget(QLabel(self.tr("Nombre:")), 2, 0)
        self._line_filename = QLineEdit()
        place_holder_text = parent.get_active_editor().filename
        self._line_filename.setPlaceholderText(place_holder_text)
        fields_box.addWidget(self._line_filename, 2, 1)
        fields_box.addWidget(QLabel(self.tr("Descripción:")), 3, 0)

        # Editor
        self._code_editor = QPlainTextEdit()
        self._set_editor_style(self._code_editor)
        self._code_editor.setPlainText(code)

        hbox = QHBoxLayout()
        hbox.addItem(QSpacerItem(0, 1, QSizePolicy.Expanding))
        btn_paste = QPushButton(self.tr("Enviar"))
        hbox.addWidget(btn_paste)
        btn_cancel = QPushButton(self.tr("Cancelar"))
        hbox.addWidget(btn_cancel)

        container.addLayout(fields_box)
        container.addWidget(self._code_editor)
        container.addLayout(hbox)

        # Loading widget
        self.loading_widget = loading_widget.LoadingWidget(self)
        self.loading_widget.hide()

        # Conexiones
        self.connect(btn_cancel, SIGNAL("clicked()"), self.close)
        self.connect(btn_paste, SIGNAL("clicked()"), self._emit_data)
Пример #31
0
    def add(self, item, left=0, right=0, top=0, bottom=0, stretch=0, fill=True, align=""):
        """ Adds a specified item to the layout manager with margins determined
            by the specified values for **left**, **right**, **top** and
            **bottom**.

            If **stretch** is 0, the item only receives as much space in the
            layout direction as it requires. If > 0, it receives an amount of
            space proportional to **stretch** when compared to the other items
            having a non-zero **stretch** value.

            If **fill** is False, the item only is the width or height it
            requests. If True, the item is expanded to fill the full width or
            height assigned to the layout manager.

            If **align** is one of the values: 'top', 'bottom', 'left',
            'right', 'hcenter' or 'vcenter', the item will be aligned
            accordingly; otherwise no special alignment is made. Note that a
            list of such values can also be specified.
        """
        layout = self.layout
        lm, tm, rm, bm = layout.getContentsMargins()

        # Update the layout's margins and get any pre/post spacing that needs
        # to be added along with the item:
        if self.is_vertical:
            pre, post = top, bottom
            nlm = max(lm, left)
            nrm = max(rm, right)
            if (nlm != lm) or (nrm != rm):
                layout.setContentsMargins(nlm, tm, nrm, bm)
        else:
            pre, post = left, right
            ntm = max(tm, top)
            nbm = max(bm, bottom)
            if (ntm != tm) or (nbm != bm):
                layout.setContentsMargins(lm, ntm, rm, nbm)

        # Determine the correct alignment flags to use:
        if not isinstance(align, list):
            alignment = align_map.get(align, 0)
        else:
            alignment = 0
            for align_item in align:
                alignment |= align_map.get(align_item, 0)

        if stretch > 0:
            ### if self.is_vertical:
            ###     alignment &= (~Qt.AlignVCenter)
            ### else:
            alignment &= ~Qt.AlignHCenter

        # fixme: Do we need this?...
        ### if not fill:
        ###     alignment = Qt.AlignCenter

        if self.columns > 0:
            # Handle adding an item to a grid layout:
            if not isinstance(item, tuple):
                item = item()
                if isinstance(item, QWidget):
                    layout.addWidget(item, self._row, self._column)
                else:
                    layout.addLayout(item, self._row, self._column)

            # Advance to the next grid cell:
            self._column += 1
            if self._column >= self.columns:
                self._column = 0
                self._row += 1
        else:
            # Check if item is a spacer (and convert it if it is):
            if isinstance(item, tuple):
                item = QSpacerItem(*item)
            else:
                if item is None:
                    from facets.extra.helper.debug import called_from

                    called_from(10)
                item = item()

            if isinstance(item, QWidget):
                # Item is a widget, add any padding as spacing:
                if pre > 0:
                    layout.addSpacing(pre)

                # Add the item itself to the layout:
                if alignment == 0:
                    layout.addWidget(item, stretch)
                else:
                    layout.addWidget(item, stretch, alignment)

                # Add any trailing spacing as needed:
                if post > 0:
                    layout.addSpacing(post)
            elif isinstance(item, QSpacerItem):
                layout.addSpacerItem(item)
            else:
                # Add the item layout or spacer to the layout:
                layout.addLayout(item, stretch)

                # Get the item's current margins and add any pre/post spacing
                # as increases to the item's margins:
                lm, tm, rm, bm = item.getContentsMargins()

                if pre > 0:
                    if self.is_vertical:
                        tm += pre
                    else:
                        lm += pre

                if post > 0:
                    if self.is_vertical:
                        bm += post
                    else:
                        rm += post

                if (pre > 0) or (post > 0):
                    item.setContentsMargins(lm, tm, rm, bm)