Example #1
0
    def set_current_directory(self, directory, reset_all=False):
        """
            Sets the current directory.

            :param directory:
                The git directory.
        """
        self._models = {}
        a_model = QGitModel(directory)
        self.current_branch = a_model.get_current_branch()

        for branch in a_model.get_branches():
            model = QEditableGitModel(self._models, directory=directory,
                                      parent=self)
            model.set_current_branch(branch)
            model.setMerge(False)
            model.enable_option("filters")
            model.populate()
            self._models[branch] = model

            QObject.connect(model, SIGNAL("newHistoryEvent"),
                            self.new_history_event)

        if reset_all:
            self.rebase_main_class.reset_interface(self._models)
            self.filter_main_class.reset_interface(self._models)
Example #2
0
def generate_category_widget(symbolCategory, symbols, synchronizer):
    """ Generate the widget for a single symbolCategory. """

    # layout for current tab
    currentWidget = QWidget()
    layout        = SymbolSelectorGridLayout()
    currentWidget.setLayout(layout)

    # sort symbols in requested order
    rawList = []
    for symbol in symbols:
        rawList.append((int(symbol["category_pos"]), symbol))

    #rawList.sort(lambda x,y: cmp(x[0], y[0]))
    rawList.sort(key=(lambda x: x[0]))

    # add them to the tab
    widgetList = {}
    for (row, symbolEntry) in enumerate(rawList):
        symbol = symbolEntry[1]
        newItem = SymbolSelectorItem(symbol, synchronizer)
        newLabel = SymbolSelectorLabel(symbol)
        layout.append_row(newItem, newLabel)

        QObject.connect(newLabel, SIGNAL("label_clicked()"),
                        newItem.click_me)

        widgetList[(symbol["name"], symbol["category"])] = newItem

    scrollArea = QScrollArea()
    scrollArea.setWidget(currentWidget)
    return (scrollArea, widgetList)
Example #3
0
    def initGui(self):
        # Actions
        self.action_convert = QAction(QIcon(path.join(_current_path, 'convert.png')),
                                      QCoreApplication.translate('RuGeocoder', 'Convert CSV to SHP'),
                                      self.iface.mainWindow())
        QObject.connect(self.action_convert, SIGNAL("triggered()"), self.run_convert)

        self.action_batch_geocoding = QAction(QIcon(path.join(_current_path, 'icon.png')),
                                              QCoreApplication.translate('RuGeocoder', 'Batch geocoding'),
                                              self.iface.mainWindow())
        QObject.connect(self.action_batch_geocoding, SIGNAL('triggered()'), self.run_batch)

        self.action_quick_geocoding = self.__quick_tlb.toggleViewAction()
        self.action_quick_geocoding.setIcon(QIcon(path.join(_current_path, 'edit-find-project.png')))
        self.action_quick_geocoding.setText(QCoreApplication.translate('RuGeocoder', '&Quick geocoding toolbox'))

        # Add toolbar button and menu item
        self.toolbar.addAction(self.action_convert)
        self.iface.addPluginToWebMenu(self.menu_name, self.action_convert)

        self.toolbar.addAction(self.action_batch_geocoding)
        self.iface.addPluginToWebMenu(self.menu_name, self.action_batch_geocoding)

        self.toolbar.addSeparator()

        self.toolbar.addAction(self.action_quick_geocoding)
        self.iface.addPluginToWebMenu(self.menu_name, self.action_quick_geocoding)
Example #4
0
    def connect_slots(self):
        """
            Connect the slots to the objects.
        """
        gui = self._ui
        # Bottom bar connections
        _connect_button(gui.applyButton, self.apply)
        _connect_button(gui.refreshButton, self.refresh)

        # Connecting actions
        self.connect(gui.actionChange_repository,
                     SIGNAL("triggered(bool)"),
                     self.change_directory)

        action_shortcuts = (
            (gui.actionUndo, QKeySequence.Undo, self.undo_history),
            (gui.actionRedo, QKeySequence.Redo, self.redo_history),
            (gui.actionQuit, QKeySequence.Quit, self.quit),
            (gui.actionShow_modifications, None, self.show_modifications),
            (gui.actionHide_modifications, None, self.hide_modifications),
            (gui.actionNew_branch, None, self.new_remote_branch),
            (gui.actionApply, None, self.apply),
            (gui.actionAbout_Gitbuster, None, self.about_box))
        for action, shortcut, slot in action_shortcuts:
            if shortcut:
                action.setShortcut(shortcut)
            QObject.connect(action, SIGNAL("triggered()"), slot)

        self.connect(self.rebase_main_class, SIGNAL("newHistAction"),
                     self.add_history_action)
        self.connect(self.rebase_main_class, SIGNAL("newBranchFromCommit"),
                     self.create_new_branch_from_model)

        shortcut = QShortcut(QKeySequence(QKeySequence.Delete), self)
        QObject.connect(shortcut, SIGNAL("activated()"), self.remove_rows)
Example #5
0
    def __init__(self, parent=None):
        QFrame.__init__(self, parent)
        self.setAutoFillBackground(True)
        self.palette().setColor(self.backgroundRole(), spec.POV_COLOR)

        self.benderButtons = bender.Buttons(self)
        self.bender = bender.Bender(self)
        self.bender.setValue(150)
        self.wheelPad = pk.widgets.WheelPad(self)
        self.history = History(self.bender, parent=self)
        self.history.setMinimumHeight(50)
        
        QObject.connect(self.benderButtons, SIGNAL('bendUp()'),
                        self.bender.bendUp)
        QObject.connect(self.benderButtons, SIGNAL('bendDown()'),
                        self.bender.bendDown)
        QObject.connect(self.benderButtons, SIGNAL('bendBack()'),
                        self.bender.bendBack)
        QObject.connect(self.bender, SIGNAL('valueChanged(float)'),
                        self.emitTempo)
        QObject.connect(self.wheelPad, SIGNAL('moved_y(int)'),
                        self.slotWheel)
        
        Layout = QVBoxLayout(self)
        Layout.setMargin(0)
        Layout.addWidget(self.history)
        Layout.addWidget(self.benderButtons)
        Layout.setStretchFactor(self.benderButtons, 0)
        Layout.addWidget(self.wheelPad)
        Layout.setStretchFactor(self.wheelPad, 1)
Example #6
0
 def addVar(self, variableToTrace):
     """ add a var to trace its value
     @param variableToTrace: variable name of the variable that shoudl be traced"""
     vw = self.variableList.addVarByName(variableToTrace)
     QObject.connect(vw, SIGNAL('replace(PyQt_PyObject, PyQt_PyObject)'), self.replaceVariable)
     newValueList = ValueList(variableToTrace, vw.getType())
     self.wave.append(newValueList)
Example #7
0
 def replaceVariable(self, pendingVar, newVar):
     """ replace existing variable in list with new one
     @param pendingVar: var to replace
     @param newVar: new var"""
     vwOld = self.variableList.getVariableWrapper(pendingVar)
     vwNew = self.variableList.replaceVar(pendingVar, newVar)
     QObject.connect(vwNew, SIGNAL('replace(PyQt_PyObject, PyQt_PyObject)'), self.replaceVariable)
Example #8
0
    def __init__(self, db, dbName, tableName):
        QtGui.QTabWidget.__init__(self)

        self.db = db
        self.dbName = dbName
        self.tableName = tableName

        self.setupUi(self)
        self.txtLimit.setValue(self.defaultLimit)

        self.lblQueryDesc.setText("SELECT * FROM %s WHERE" % self.db.quoteIdentifier(self.tableName))
        QObject.connect(self.txtWhere, SIGNAL("returnPressed()"), self.refreshData)

        self.db.setDatabase(self.dbName)

        #Retrieve
        self.refreshInfo()
        self.refreshStructure()
        self.refreshIndexes()

        #Data
        self.tableModel = QPyTableModel(self, self.db)
        self.tableModel.setTable(self.tableName)
        self.tableData.setModel(self.tableModel)

        self.refreshData()
Example #9
0
    def accept(self):
        inShape = self.inShape.currentText()
        outDir = self.outShape.text()
        if inShape == "":
            QMessageBox.information(self, self.tr("Vector Split"),
                                    self.tr("No input shapefile specified"))
            return
        elif outDir == "":
            QMessageBox.information(self, self.tr("Vector Split"),
                                    self.tr("Please specify output shapefile"))
            return

        self.btnOk.setEnabled( False )

        vLayer = ftools_utils.getVectorLayerByName(unicode(self.inShape.currentText()))
        self.workThread = SplitThread(vLayer, self.inField.currentText(), self.encoding, outDir)

        QObject.connect(self.workThread, SIGNAL("rangeCalculated(PyQt_PyObject)"), self.setProgressRange)
        QObject.connect(self.workThread, SIGNAL("valueProcessed()"), self.valueProcessed)
        QObject.connect(self.workThread, SIGNAL("processFinished(PyQt_PyObject)"), self.processFinished)
        QObject.connect(self.workThread, SIGNAL("processInterrupted()"), self.processInterrupted)

        self.btnClose.setText(self.tr("Cancel"))
        QObject.disconnect(self.buttonBox_2, SIGNAL("rejected()"), self.reject)
        QObject.connect(self.btnClose, SIGNAL("clicked()"), self.stopProcessing)

        self.workThread.start()
 def setupUi(self):
     self.valueItems = {}
     self.dependentItems = {}
     self.resize(650, 450)
     self.buttonBox = QDialogButtonBox()
     self.buttonBox.setOrientation(Qt.Horizontal)
     self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel
                                       | QDialogButtonBox.Ok)
     self.infoText = QTextEdit()
     numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber)
     text = self.tr('You can refer to model values in your formula, using '
                    'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog')
     ichar = 97
     if numbers:
         for number in numbers:
             text += chr(ichar) + '->' + self.resolveValueDescription(number) + '\n'
             ichar += 1
     else:
         text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog')
     self.infoText.setText(text)
     self.infoText.setEnabled(False)
     self.formulaText = QLineEdit()
     if hasattr(self.formulaText, 'setPlaceholderText'):
         self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog'))
     self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog'))
     self.verticalLayout = QVBoxLayout()
     self.verticalLayout.setSpacing(2)
     self.verticalLayout.setMargin(0)
     self.verticalLayout.addWidget(self.infoText)
     self.verticalLayout.addWidget(self.formulaText)
     self.verticalLayout.addWidget(self.buttonBox)
     self.setLayout(self.verticalLayout)
     QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed)
     QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed)
     QMetaObject.connectSlotsByName(self)
def install_dict(dict):
    global t
    mw.progress.start(immediate=True)
    t = installerThread(dict)
    QObject.connect(t, SIGNAL('install_finished'), install_finished, QtCore.Qt.QueuedConnection)
    QObject.connect(t, SIGNAL('install_failed'), install_failed, QtCore.Qt.QueuedConnection)
    t.start()
Example #12
0
 def start(self):
     self.setIptables(self.APmode,option='A')
     self.procThreadDNS = QProcess(self)
     self.procThreadDNS.setProcessChannelMode(QProcess.MergedChannels)
     QObject.connect(self.procThreadDNS, SIGNAL('readyReadStandardOutput()'), self, SLOT('readProcessOutput()'))
     self.procThreadDNS.start('python',['Core/packets/dnsspoofNF.py','-r',self.redirect,
     '-d',','.join(self.domains)])
    def addDockWidget(self, wdg, position = None):
        if position is None:
            position = wdg.getLocation()
        else:
            wdg.setLocation(position)

        mapCanvas = self.iface.mapCanvas()
        oldSize = mapCanvas.size()

        prevFlag = mapCanvas.renderFlag()
        mapCanvas.setRenderFlag(False)
        self.iface.addDockWidget(position, wdg)

        wdg.setNumber(self.lastDockableMirror)
        self.lastDockableMirror = self.lastDockableMirror + 1
        self.dockableMirrors.append(wdg)

        QObject.connect(wdg, SIGNAL("closed(PyQt_PyObject)"), self.onCloseDockableMirror)

        newSize = mapCanvas.size()
        if newSize != oldSize:
            # trick: update the canvas size
            mapCanvas.resize(newSize.width() - 1, newSize.height())
            mapCanvas.setRenderFlag(prevFlag)
            mapCanvas.resize(newSize)
        else:
            mapCanvas.setRenderFlag(prevFlag)
Example #14
0
    def run(self):
        if self._configuration:
            try:
                self._configuration.check_all()

                self._reinit_simu()

                self._progress_bar = QProgressDialog("Simulating...", "Abort",
                                                     0, 100)
                self._progress_bar.canceled.connect(self.abort)
                self._progress_bar.show()

                self.worker = RunSimulation()
                self._model = Model(self._configuration,
                                    callback=self.worker.updateProgressBar)
                self.worker.set_model(self._model)

                self.worker.finished.connect(self.runFinished)
                self.worker.start()
                QObject.connect(self.worker, SIGNAL("updateProgressBar"),
                                self.updateProgressBar)

            except Exception as msg:
                QMessageBox.warning(self, "Configuration error", str(msg))
                self._reinit_simu()
                self.runFinished()
    def __init__(self):
        super(CreateNewScanWidget, self).__init__()

        self.ui = Ui_CreateNewScan()
        self.ui.setupUi(self)
        self.setTitle("Create Scan")
        self.setSubTitle(
            "The list below shows the drives and directories that you can choose to scan.  You can select more than one drive or directory to include in this scan."
        )
        self.__loadListOfDocuments()

        # required fields
        self.registerField("scanPaths", self)

        self.ui.listWidget.setAttribute(Qt.WA_MacShowFocusRect, False)

        self.ui.addButton.clicked.connect(self.__onAddClicked)
        self.ui.removeButton.clicked.connect(self.__onRemoveClicked)
        self.ui.listWidget.itemSelectionChanged.connect(self.__onListSelectionChanged)

        # make it possible to validate the entered paths (whenever data is changed in the underlying model)
        QObject.connect(
            self.ui.listWidget.model(), SIGNAL("dataChanged(QModelIndex, QModelIndex)"), self.__validatePaths
        )
        self.ui.lineEditDocumentName.textChanged.connect(self.__slotDocumentNameChanged)

        self.__validatePaths()

        self.setButtonText(QWizard.NextButton, "Start Scan")
Example #16
0
    def initialize(self, synchronizer, colors):

        self._synchronizer = synchronizer
   
        # set up layout
        layout = QHBoxLayout()

        # we need to keep a list of all ColorSelectorItems so we can
        # parse them later for their colors when saving as spf
        # or set their color when loading an spf.
        self.colorWidgets = []
        for color in colors:
            newItem = ColorSelectorItem(color, synchronizer)
            layout.addWidget(newItem)
            self.colorWidgets.append(newItem)
            if color == QColor(Qt.white):
                synchronizer.select(newItem)

        colorButton = QPushButton("customize color")
        QObject.connect(colorButton, SIGNAL("pressed()"),
                        self.customized_color_button_pressed)
        layout.addWidget(colorButton)
        layout.addStretch()
        
        self.setLayout(layout)
Example #17
0
    def menu_button(self, main_action_id, ids, widget):
        '''
            Creates an :obj:`.OWButton` with a popup-menu and adds it to the parent ``widget``.
        '''
        id, name, attr_name, attr_value, callback, icon_name = self._expand_id(main_action_id)
        b = OWButton(parent=widget)
        m = QMenu(b)
        b.setMenu(m)
        b._actions = {}

        QObject.connect(m, SIGNAL("triggered(QAction*)"), b, SLOT("setDefaultAction(QAction*)"))

        if main_action_id:
            main_action = OWAction(self._plot, icon_name, attr_name, attr_value, callback, parent=b)
            QObject.connect(m, SIGNAL("triggered(QAction*)"), main_action, SLOT("trigger()"))

        for id in ids:
            id, name, attr_name, attr_value, callback, icon_name = self._expand_id(id)
            a = OWAction(self._plot, icon_name, attr_name, attr_value, callback, parent=m)
            m.addAction(a)
            b._actions[id] = a

        if m.actions():
            b.setDefaultAction(m.actions()[0])
        elif main_action_id:
            b.setDefaultAction(main_action)


        b.setPopupMode(QToolButton.MenuButtonPopup)
        b.setMinimumSize(40, 30)
        return b
Example #18
0
 def _open_wmts(self, name, capabilites_url):
     # Add new HTTPConnection like in source
     # https://github.com/qgis/QGIS/blob/master/src/gui/qgsnewhttpconnection.cpp
     
     self.msg_log(u'add WM(T)S: Name = {0}, URL = {1}'.format(name, capabilites_url))
     
     s = QSettings()
     
     s.setValue(u'Qgis/WMS/{0}/password'.format(name), '')
     s.setValue(u'Qgis/WMS/{0}/username'.format(name), '')
     s.setValue(u'Qgis/connections-wms/{0}/dpiMode'.format(name), 7)  # refer to https://github.com/qgis/QGIS/blob/master/src/gui/qgsnewhttpconnection.cpp#L229-L247
     s.setValue(u'Qgis/connections-wms/{0}/ignoreAxisOrientation'.format(name), False)
     s.setValue(u'Qgis/connections-wms/{0}/ignoreGetFeatureInfoURI'.format(name), False)
     s.setValue(u'Qgis/connections-wms/{0}/ignoreGetMapURI'.format(name), False)
     s.setValue(u'Qgis/connections-wms/{0}/invertAxisOrientation'.format(name), False)
     s.setValue(u'Qgis/connections-wms/{0}/referer'.format(name), '')
     s.setValue(u'Qgis/connections-wms/{0}/smoothPixmapTransform'.format(name), False)
     s.setValue(u'Qgis/connections-wms/{0}/url'.format(name), capabilites_url)
     
     s.setValue(u'Qgis/connections-wms/selected', name)
     
     # create new dialog
     wms_dlg = QgsProviderRegistry.instance().selectWidget("wms", self.main_win)
     
     QObject.connect(wms_dlg, SIGNAL( "addRasterLayer( QString const &, QString const &, QString const & )" ),
                self.main_win, SLOT( "addRasterLayer( QString const &, QString const &, QString const & )" ) )
     
     wms_dlg.show()
Example #19
0
    def initValues(self):
        for ctrl, info in self.VolumeControls.iteritems():
            vol = self.hw.getContignuous(self.VolumeControls[ctrl][0], self.VolumeControls[ctrl][1])
            val = -vol
            log.debug("%s volume is %d, set to %d" % (ctrl.objectName(), vol, val))
            ctrl.setValue(val)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateVolume)

        for ctrl, info in self.PanControls.iteritems():
            pan_left = self.hw.getContignuous(self.PanControls[ctrl][0], 1)
            pan_right = self.hw.getContignuous(self.PanControls[ctrl][0], 2)

            log.debug("%s pan left is %d" % (ctrl.objectName() , pan_left))
            log.debug("%s pan right is %d" % (ctrl.objectName() , pan_right))

            if pan_left == 0:
                val = pan_right
            else:
                val = -pan_left

            ctrl.setValue(val)
            # connect the UI element
            QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updatePan)
Example #20
0
    def __init__(self, show_strength=True, parent=None):
        super(PinMatrixWidget, self).__init__(parent)
        
        self.password = QLineEdit()
        self.password.setValidator(QRegExpValidator(QRegExp('[1-9]+'), None))
        self.password.setEchoMode(QLineEdit.Password)
        QObject.connect(self.password, SIGNAL('textChanged(QString)'), self._password_changed)

        self.strength = QLabel()
        self.strength.setMinimumWidth(75)
        self.strength.setAlignment(Qt.AlignCenter)
        self._set_strength(0)

        grid = QGridLayout()
        grid.setSpacing(0)
        for y in range(3)[::-1]:
            for x in range(3):
                button = PinButton(self.password, x + y * 3 + 1)
                button.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
                button.setFocusPolicy(Qt.NoFocus)
                grid.addWidget(button, 3 - y, x)

        hbox = QHBoxLayout()
        hbox.addWidget(self.password)
        if show_strength:
            hbox.addWidget(self.strength)

        vbox = QVBoxLayout()
        vbox.addLayout(grid)
        vbox.addLayout(hbox)
        self.setLayout(vbox)
    def initGui(self):
        # Create action that will start plugin configuration
        self.copy_action = QAction(
            QIcon(':/plugins/geometrycopier/mActionEditCopyGeom.png'),
            self.tr(u"Copy geometry"), self.iface.mainWindow())

        self.insert_action = QAction(
            QIcon(':/plugins/geometrycopier/mActionEditPasteGeom.png'),
            self.tr(u"Insert geometry"), self.iface.mainWindow())

        # connect the action to the run method
        QObject.connect(self.copy_action, SIGNAL("triggered()"), self.copy_geometry)
        QObject.connect(self.insert_action, SIGNAL("triggered()"), self.insert_geometry)

        # Add hotkeys
        self.iface.registerMainWindowAction(self.copy_action, "F7")
        self.iface.registerMainWindowAction(self.insert_action, "F8")

        # Add toolbar button and menu item
        self.iface.digitizeToolBar().addAction(self.copy_action)
        self.iface.digitizeToolBar().addAction(self.insert_action)
        self.iface.addPluginToVectorMenu(u"&Geometry copier", self.copy_action)
        self.iface.addPluginToVectorMenu(u"&Geometry copier", self.insert_action)

        # Add global signals
        QObject.connect(self.iface, SIGNAL('currentLayerChanged(QgsMapLayer *)'), self.check_buttons_state)
        QObject.connect(self.iface.mapCanvas(), SIGNAL('selectionChanged(QgsMapLayer *)'), self.check_buttons_state)
        QObject.connect(self.iface.actionToggleEditing(), SIGNAL('triggered()'), self.check_buttons_state)

        #iface.actionToggleEditing().triggered

        # init state
        self.check_buttons_state(None)
Example #22
0
    def __init__(self, distributed_objects):
        QObject.__init__(self)
        self.distributed_objects = distributed_objects

        self.gdbioView = GdbIoView(self.distributed_objects.debug_controller)

        QObject.connect(self.distributed_objects.signal_proxy, SIGNAL("insertDockWidgets()"), self.insertDockWidgets)
Example #23
0
    def __init__(self):            
        QMainWindow.__init__(self)
        self.setupUi(self)
        self.setupTable()
        self.settings = Settings(self)
        self.ocr_all_set = False
        self.fields = [self.name, self.sell, self.buy, self.demand_num, self.demand,
                       self.supply_num, self.supply]
        self.canvases = [self.name_img, self.sell_img, self.buy_img, self.demand_img,
                         self.demand_text_img, self.supply_img, self.supply_text_img]
        #setup buttons
        self.add_button.clicked.connect(self.addFiles)
        self.remove_button.clicked.connect(self.removeFile)
        self.save_button.clicked.connect(self.addItemToTable)
        self.skip_button.clicked.connect(self.nextLine)
        self.ocr_button.clicked.connect(self.performOCR)
        self.ocr_all.clicked.connect(self.runOCRAll)
        self.export_button.clicked.connect(self.exportTable)
        self.clear_table.clicked.connect(self.clearTable)
        
        QObject.connect(self.actionHow_to_use, SIGNAL('triggered()'), self.howToUse)
        QObject.connect(self.actionAbout, SIGNAL('triggered()'), self.About)
        QObject.connect(self.actionOpen, SIGNAL('triggered()'), self.addFiles)
        QObject.connect(self.actionPreferences, SIGNAL('triggered()'), self.openSettings)
        QObject.connect(self.actionCalibrate, SIGNAL('triggered()'), self.openCalibrate)
        self.error_close = False
        if not isfile("./tessdata/big.traineddata"):
            QMessageBox.critical(self,"Error", "OCR training data not found!\n"+\
            "Make sure tessdata directory exists and contains big.traineddata.")
            self.error_close = True

        #set up required items for nn
        self.training_image_dir = self.settings.app_path +"\\nn_training_images\\"
Example #24
0
 def add(self, part):
     if isinstance(part.parent(), DropTarget):
         part.parent().remove(part)
     self.parts.append(part)
     QObject.connect(part, SIGNAL('selected(QWidget *)'),
                     self, SIGNAL('selected(QWidget *)'))
     self._rearrange()
    def __init__(self, tool_library_node, callback, parent_widget = None):
        QDialog.__init__(self, parent_widget)
        self.setupUi(self)

        self.tool_library_node = tool_library_node
        self.callback = callback

        self.vars = {}
        # To test... add some dummy vars
        self.vboxlayout = QVBoxLayout(self.variableBox)
        self.vboxlayout.setMargin(9)
        self.vboxlayout.setSpacing(6)
        self.vboxlayout.setObjectName("vboxlayout")
        self.test_widget = []
        self.hboxlayout = []
        self.test_text = []
        self.test_text_type = []
        self.test_line = []

        self.tool_nodes = {}
        for tool_group_node in tool_library_node:
            for tool_file_node in tool_group_node:
                self.tool_nodes[tool_file_node.get('name')] = tool_file_node
                self.comboBox.addItem(tool_file_node.get('name'))

        # Now we hook up to the user selecting the type desired
        QObject.connect(self.comboBox, SIGNAL("currentIndexChanged(int)"),
                        self.toolTypeSelected)

        self.tooltypearray = []
        self.typeSelection = None
        self.setWindowTitle(QString("Add and configure tool..."))
Example #26
0
 def setTab(self):
     self.tab = self.tabBar()
     self.tab.setContextMenuPolicy(Qt.CustomContextMenu)
     QObject.connect(self.tab, SIGNAL('customContextMenuRequested(const QPoint&)'), self.showContextMenu)
     
     self.popMenu = QMenu(self)
     self.popMenu.addAction("Detach tab", self.detach)
    def __init__(self, mainwindow, filePath):
        QWidget.__init__(self, mainwindow)
        self.mainwindow = mainwindow

        self.tabIcon = QIcon(":/Images/Images/chart_organisation.png")
        self.tabLabel = "Documentation Tab"

        self.tab = QWidget(self.mainwindow)

        self.widgetLayout = QVBoxLayout(self.tab)
        self.widgetLayout.setAlignment(Qt.AlignTop)
        self.docStatusLabel = QLabel(self.tab)
        self.docStatusLabel.setAlignment(Qt.AlignCenter)
        self.docStatusLabel.setObjectName("docStatusLabel")
        self.docStatusLabel.setText(QString("No documentation currently loaded..."))
        self.widgetLayout.addWidget(self.docStatusLabel)

        self.pbnRemoveDoc = QPushButton(self.tab)
        self.pbnRemoveDoc.setObjectName("pbnRemoveDoc")
        self.pbnRemoveDoc.setText(QString("Remove Documentation"))
        QObject.connect(self.pbnRemoveDoc, SIGNAL("clicked()"),
                        self.clicked)
        self.widgetLayout.addWidget(self.pbnRemoveDoc)

        self.docStuff = DocumentationBase(self.mainwindow,filePath)
        self.widgetLayout.addWidget(self.docStuff)
        self.docStatusLabel.setText(QString(filePath))

        self.mainwindow.tabWidget.insertTab(0,self.tab,self.tabIcon,self.tabLabel)
        self.mainwindow.tabWidget.setCurrentIndex(0)
    def __init__(self, layer):
        QDialog.__init__(self)
        # set up the user interface
        self.ui = FORM_CLASS()
        self.ui.setupUi(self)
        self.setWindowTitle(u"%s - %s" % (self.tr("Layer Properties"), layer.name()))

        self.layer = layer
        # signals
        self.ui.horizontalSlider_Transparency.valueChanged.connect(self.ui.spinBox_Transparency.setValue)
        self.ui.spinBox_Transparency.valueChanged.connect(self.ui.horizontalSlider_Transparency.setValue)
        self.ui.horizontalSlider_Brightness.valueChanged.connect(self.ui.spinBox_Brightness.setValue)
        self.ui.spinBox_Brightness.valueChanged.connect(self.ui.horizontalSlider_Brightness.setValue)
        self.ui.horizontalSlider_Contrast.valueChanged.connect(lambda x: self.ui.doubleSpinBox_Contrast.setValue(x/100.0))
        self.ui.doubleSpinBox_Contrast.valueChanged.connect(lambda x: self.ui.horizontalSlider_Contrast.setValue(x*100))

        QObject.connect(self.ui.buttonBox.button(QDialogButtonBox.Apply), SIGNAL("clicked()"), self,
                        SIGNAL("applyClicked()"))
        # set init values
        self.initBlendingCombo()
        self.ui.textEdit_Properties.setText(layer.metadata())
        self.ui.spinBox_Transparency.setValue(layer.transparency)
        self.ui.spinBox_Brightness.setValue(layer.brigthness)
        self.ui.doubleSpinBox_Contrast.setValue(layer.contrast)
        i = self.ui.comboBox_BlendingMode.findText(layer.blendModeName)
        if i != -1:
            self.ui.comboBox_BlendingMode.setCurrentIndex(i)

        self.ui.checkBox_SmoothRender.setChecked(layer.smoothRender)
        self.ui.checkBox_CreditVisibility.setChecked(layer.creditVisibility)
        self.ui.checkBox_Grayscale.setChecked(layer.grayscaleRender)
Example #29
0
    def __init__(self, stack_controller, parent = None):
        QWidget.__init__(self, parent)
        
        self.gridLayout = QtGui.QGridLayout(self)
        self.gridLayout.setMargin(0)

        self.stackView = QtGui.QTableView(self)
        self.stackView.setTabKeyNavigation(False)
        self.stackView.setAlternatingRowColors(True)
        self.stackView.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
        self.stackView.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
        self.stackView.setShowGrid(False)
        self.stackView.setSortingEnabled(True)
        self.stackView.setCornerButtonEnabled(False)
        self.stackView.verticalHeader().setVisible(False)
        self.stackView.verticalHeader().setDefaultSectionSize(20)
        self.stackView.horizontalHeader().setStretchLastSection(True)
        self.gridLayout.addWidget(self.stackView, 0, 0, 1, 1)
        
        self.showStackTrace = QtGui.QCheckBox("Highlight stack trace", self)
        self.gridLayout.addWidget(self.showStackTrace, 1, 0, 1, 1)

        QtCore.QMetaObject.connectSlotsByName(self)
        
        QObject.connect(self.stackView, SIGNAL('activated(QModelIndex)'), stack_controller.stackInStackViewActivated)
Example #30
0
 def run(self):
     logger.debug(u"run, processing name {}".format(self.processing_name))
     logger.debug(u"self.arg {}".format(self.arg))
     output_filename = ""
     if "NDVI" in self.processing_name:
         output_filename = terre_image_processing.ndvi(self.layer, self.working_directory)
     if "NDTI" in self.processing_name:
         output_filename = terre_image_processing.ndti(self.layer, self.working_directory)
     if "Indice de brillance" in self.processing_name:
         output_filename = terre_image_processing.brightness(self.layer, self.working_directory)
     if "Angle Spectral" in self.processing_name:
         self.rubberband = QgsRubberBand(self.canvas, QGis.Point)
         self.rubberband.setWidth(10)
         self.rubberband.setColor(QColor(Qt.yellow))
         if not self.arg:
             from spectral_angle import SpectralAngle
             self.angle_tool = SpectralAngle(self.iface, self.working_directory, self.layer, self.mirrormap_tool, self.rubberband)
             logger.debug("self.angle_tool {}".format(self.angle_tool))
             QObject.connect(self.angle_tool, SIGNAL("anglesComputed(PyQt_PyObject)"), self.display)
             self.angle_tool.get_point_for_angles(self.layer)
             # spectral_angles(self.layer, self.working_directory, self.iface)
         else:
             output_filename = self.arg
     if "KMEANS" in self.processing_name:
         if self.arg:
             output_filename = terre_image_processing.kmeans(self.layer, self.working_directory, self.arg)
         else:
             output_filename = terre_image_processing.kmeans(self.layer, self.working_directory)
     if "Seuillage" in self.processing_name and self.arg:
         logger.debug("this is thrshold")
         output_filename = terre_image_processing.threshold(self.layer, self.working_directory, self.arg)
     if output_filename:
         terre_image_gdal_system.compute_overviews(output_filename)
         logger.debug(output_filename)
         self.display(output_filename)
Example #31
0
    def __init__(self, plugin, layerDef, creditVisibility=1):
        QgsPluginLayer.__init__(self, TileLayer.LAYER_TYPE, layerDef.title)
        self.plugin = plugin
        self.iface = plugin.iface
        self.layerDef = layerDef
        self.creditVisibility = 1 if creditVisibility else 0

        # set custom properties
        self.setCustomProperty("title", layerDef.title)
        self.setCustomProperty("credit",
                               layerDef.credit)  # TODO: need to remove
        self.setCustomProperty("serviceUrl", layerDef.serviceUrl)
        self.setCustomProperty("yOriginTop", layerDef.yOriginTop)
        self.setCustomProperty("zmin", layerDef.zmin)
        self.setCustomProperty("zmax", layerDef.zmax)
        if layerDef.bbox:
            self.setCustomProperty("bbox", layerDef.bbox.toString())
        self.setCustomProperty("creditVisibility", self.creditVisibility)

        # set standard/custom crs
        self.setCrs(self.CRS_3857)
        try:
            crs = None
            if layerDef.epsg_crs_id is not None:
                crs = QgsCoordinateReferenceSystem(
                    layerDef.epsg_crs_id,
                    QgsCoordinateReferenceSystem.EpsgCrsId)
            if layerDef.postgis_crs_id is not None:
                crs = QgsCoordinateReferenceSystem(
                    layerDef.postgis_crs_id,
                    QgsCoordinateReferenceSystem.PostgisCrsId)
            if layerDef.custom_proj is not None:
                # create form proj4 str
                custom_crs = QgsCoordinateReferenceSystem()
                custom_crs.createFromProj4(layerDef.custom_proj)
                # try to search in db
                searched = custom_crs.findMatchingProj()
                if searched:
                    crs = QgsCoordinateReferenceSystem(
                        searched, QgsCoordinateReferenceSystem.InternalCrsId)
                else:
                    # create custom and use it
                    custom_crs.saveAsUserCRS('quickmapservices %s' %
                                             layerDef.title)
                    searched = custom_crs.findMatchingProj()
                    if searched:
                        crs = QgsCoordinateReferenceSystem(
                            searched,
                            QgsCoordinateReferenceSystem.InternalCrsId)
                    else:
                        crs = custom_crs

            if crs:
                self.setCrs(crs)
        except:
            msg = self.tr("Custom crs can't be set for layer {0}!").format(
                layerDef.title)
            self.showBarMessage(msg, QgsMessageBar.WARNING, 4)

        if layerDef.bbox:
            self.setExtent(
                BoundingBox.degreesToMercatorMeters(
                    layerDef.bbox).toQgsRectangle())
        else:
            self.setExtent(
                QgsRectangle(-layerDef.TSIZE1, -layerDef.TSIZE1,
                             layerDef.TSIZE1, layerDef.TSIZE1))
        self.setValid(True)
        self.tiles = None
        self.useLastZoomForPrint = False
        self.canvasLastZoom = 0
        self.setTransparency(LayerDefaultSettings.TRANSPARENCY)
        self.setBlendModeByName(LayerDefaultSettings.BLEND_MODE)
        self.setSmoothRender(LayerDefaultSettings.SMOOTH_RENDER)

        # downloader
        self.downloader = Downloader(self)
        self.downloader.userAgent = QGISSettings.get_default_user_agent()
        self.downloader.default_cache_expiration = QGISSettings.get_default_tile_expiry(
        )
        self.downloader.max_connection = PluginSettings.default_tile_layer_conn_count(
        )  #TODO: Move to INI files
        QObject.connect(self.downloader,
                        SIGNAL("replyFinished(QString, int, int)"),
                        self.networkReplyFinished)

        #network
        self.downloadTimeout = QGISSettings.get_default_network_timeout()

        # multi-thread rendering
        self.eventLoop = None
        QObject.connect(self, SIGNAL("fetchRequest(QStringList)"),
                        self.fetchRequest)
        if self.iface:
            QObject.connect(self, SIGNAL("showMessage(QString, int)"),
                            self.showStatusMessageSlot)
            QObject.connect(
                self, SIGNAL("showBarMessage(QString, QString, int, int)"),
                self.showBarMessageSlot)
Example #32
0
    def __init__(self, password, encoded_value):
        super(PinButton, self).__init__('?')
        self.password = password
        self.encoded_value = encoded_value

        QObject.connect(self, SIGNAL('clicked()'), self._pressed)
Example #33
0
    def get_value(self):
        return self.password.text()


if __name__ == '__main__':
    '''
        Demo application showing PinMatrix widget in action
    '''
    a = QApplication(sys.argv)

    matrix = PinMatrixWidget()

    def clicked():
        print "PinMatrix value is", matrix.get_value()
        print "Possible button combinations:", matrix.get_strength()
        sys.exit()

    ok = QPushButton('OK')
    QObject.connect(ok, SIGNAL('clicked()'), clicked)

    vbox = QVBoxLayout()
    vbox.addWidget(matrix)
    vbox.addWidget(ok)

    w = QWidget()
    w.setLayout(vbox)
    w.move(100, 100)
    w.show()

    a.exec_()
    def _ShowProperties(self, obj):
        self.selected_shapebody = None, None

        class_ = obj.__class__
        ignore_list = ('thisown', )

        i = 0
        twProperties = self.window.twProperties
        # Get all of the members of the class
        for prop in dir(class_):
            # If they're properties and not to be ignored, add them to the table widget
            if isinstance(getattr(class_, prop),
                          property) and prop not in ignore_list:
                try:
                    value = getattr(obj, prop)
                except:
                    # Write-only?
                    continue

                widget = None

                # Attempt to determine whether it's read-only or not
                try:
                    setattr(obj, prop, value)
                except:
                    editable = False
                else:
                    editable = True

                # Increase the row count and insert the new item
                twProperties.setRowCount(twProperties.rowCount() + 1)
                i = twProperties.rowCount() - 1
                self.item = QTableWidgetItem(class_.__name__)
                twProperties.setItem(i, 0, QTableWidgetItem(
                    class_.__name__))  # class name
                twProperties.item(i, 0).setFlags(Qt.ItemIsEnabled)

                twProperties.setItem(i, 1,
                                     QtGui.QTableWidgetItem(prop))  # prop name
                twProperties.item(i, 1).setFlags(Qt.ItemIsEnabled)

                # and finally, the property values
                # booleans are checkboxes
                if isinstance(value, bool):
                    widget = QtGui.QCheckBox('')
                    QObject.connect(
                        widget,
                        SIGNAL('stateChanged(int)'),
                        lambda value, prop=prop: self.property_changed(
                            prop, value == Qt.Checked))
                    if value:
                        widget.setCheckState(Qt.Checked)
                # ints, floats are spinboxes
                elif isinstance(value, (int, float)):
                    widget = QtGui.QDoubleSpinBox()
                    QObject.connect(widget,
                                    SIGNAL('valueChanged(double)'),
                                    lambda value, prop=prop: self.
                                    property_changed(prop, value))
                    widget.setValue(value)
                # lists turn into -- lists
                elif isinstance(value, list):
                    widget = QtGui.QListWidget()
                    for entry in value:
                        widget.addItem(str(entry))
                    if value:
                        #sz=widget.item(0).sizeHint()
                        #print(sz, sz.width(), sz.height())
                        #sz.setHeight(sz.height()*2)
                        #widget.setMinimumSize(sz)
                        #widget.setMinimumSize(QtCore.QSize(1,60))
                        pass  # TODO
                # vec2s will be shown as a textbox
                elif isinstance(value, b2Vec2):
                    value = '(%.2f, %.2f)' % (tuple(value))
                else:
                    pass

                if widget:
                    twProperties.setCellWidget(i, 2, widget)
                    if hasattr(widget, 'setReadOnly'):
                        widget.setReadOnly(not editable)
                    elif hasattr(widget, 'setEnabled'):
                        widget.setEnabled(editable)
                else:
                    # Just using the table widget, set the cell text
                    cell = QtGui.QTableWidgetItem(str(value))
                    if editable:
                        cell.setFlags(Qt.ItemIsEditable | Qt.ItemIsEnabled)
                    else:
                        cell.setFlags(Qt.ItemIsEnabled)
                    twProperties.setItem(i, 2, cell)

                i += 1
Example #35
0
    def addOutputTab(self, tabs):
        tab_out = QWidget(self)
        tabs.addTab(tab_out, "Out")

        layout = QHBoxLayout()
        tab_out.setLayout(layout)

        out_labels = self.labels[self.id]["outputs"]
        out_ids = self.outputs[self.id]

        mixer_labels = self.labels[self.id]["mixers"]

        if self.jack_src[self.id] is None:
            for i in range(len(out_ids)):
                label = QLabel(tab_out)
                layout.addWidget(label)
                label.setText("%s Out is fixed to %s Out" %
                              (mixer_labels[i], out_labels[i]))
            return

        mixer_ids = self.jack_src[self.id][1]

        for i in range(len(out_ids)):
            out_label = out_labels[i]
            if out_label.find('Headphone') >= 0:
                continue

            out_id = self.jack_src[self.id][0][i]

            widget = MAudio_BeBoB_Output_Widget(tab_out)
            layout.addWidget(widget)

            widget.name.setText(out_label)

            self.Volumes[widget.l_sld] = [
                "/Mixer/Feature_Volume_%d" % out_ids[i], 1, widget.r_sld, 2,
                widget.link
            ]
            self.Volumes[widget.r_sld] = [
                "/Mixer/Feature_Volume_%d" % out_ids[i], 2, widget.l_sld, 1,
                widget.link
            ]
            self.Mutes[widget.mute] = [widget.l_sld, widget.r_sld]

            self.Selectors[widget.cmb_src] = ["/Mixer/Selector_%d" % out_id]

            for j in range(len(mixer_ids)):
                if (i != j and j != len(mixer_ids) - 1):
                    continue
                widget.cmb_src.addItem("%s Out" % mixer_labels[j],
                                       mixer_ids[j])

        # add headphone
        hp_idx = 0
        for i in range(len(out_ids)):
            out_label = out_labels[i]
            if out_label.find('Headphone') < 0:
                continue

            hp_label = self.labels[self.id]["outputs"][i]
            hp_id = self.hp_src[self.id][0][hp_idx]
            hp_idx += 1

            mixer_labels = self.labels[self.id]["mixers"]

            widget = MAudio_BeBoB_Output_Widget(tab_out)
            layout.addWidget(widget)

            widget.name.setText(hp_label)

            mixer_labels = self.labels[self.id]["mixers"]
            mixer_ids = self.mixers[self.id][0]

            self.Volumes[widget.l_sld] = [
                "/Mixer/Feature_Volume_%d" % out_ids[i], 1, widget.r_sld, 2,
                widget.link
            ]
            self.Volumes[widget.r_sld] = [
                "/Mixer/Feature_Volume_%d" % out_ids[i], 2, widget.l_sld, 1,
                widget.link
            ]
            self.Mutes[widget.mute] = [widget.l_sld, widget.r_sld]

            for i in range(len(mixer_ids)):
                widget.cmb_src.addItem("%s Out" % mixer_labels[i],
                                       mixer_ids[i])

            if self.id != 3:
                self.Selectors[widget.cmb_src] = ["/Mixer/Selector_%d" % hp_id]
            else:
                QObject.connect(widget.cmb_src, SIGNAL('activated(int)'),
                                self.update410HP)
                self.FW410HP = widget.cmb_src

        layout.addStretch()
Example #36
0
    def __init__(self, menu, tool, main):
        self._main = main

        newAction = menu.addAction(QIcon(resources.images['new']),
                                   '&New (' + OS_KEY + '+N)')
        newProjectAction = menu.addAction(QIcon(resources.images['newProj']),
                                          'New Pro&ject (' + OS_KEY + '+J)')
        menu.addSeparator()
        saveAction = menu.addAction(QIcon(resources.images['save']),
                                    '&Save (' + OS_KEY + '+S)')
        saveAsAction = menu.addAction(QIcon(resources.images['saveAs']),
                                      'Save &As')
        saveAllAction = menu.addAction(QIcon(resources.images['saveAll']),
                                       'Save A&ll (' + OS_KEY + '+Shift+S)')
        menu.addSeparator()
        reloadFileAction = menu.addAction(
            QIcon(resources.images['reload-file']), 'Reload File (F5)')
        menu.addSeparator()
        openAction = menu.addAction(QIcon(resources.images['open']),
                                    '&Open (' + OS_KEY + '+O)')
        openProjectAction = menu.addAction(QIcon(resources.images['openProj']),
                                           'Open &Project (' + OS_KEY + '+P)')
        openProjectTypeAction = menu.addAction(
            QIcon(resources.images['openProj']), 'Open Project &Type')
        menu.addSeparator()
        printFile = menu.addAction(QIcon(resources.images['print']),
                                   'Pr&int File (' + OS_KEY + '+I)')
        closeAction = menu.addAction(
            self._main.style().standardIcon(QStyle.SP_DialogCloseButton),
            '&Close Tab')
        menu.addSeparator()
        exitAction = menu.addAction(
            self._main.style().standardIcon(QStyle.SP_DialogCloseButton),
            '&Exit')

        tool.addAction(newAction)
        tool.addAction(newProjectAction)
        tool.addAction(openAction)
        tool.addAction(openProjectAction)
        tool.addAction(saveAction)
        #tool.addAction(saveAllAction)

        QObject.connect(newAction, SIGNAL("triggered()"), main.new_editor)
        QObject.connect(newProjectAction, SIGNAL("triggered()"),
                        main.new_project)
        QObject.connect(openAction, SIGNAL("triggered()"), main.open_file)
        QObject.connect(saveAction, SIGNAL("triggered()"), main.save)
        QObject.connect(saveAsAction, SIGNAL("triggered()"), main.save_as)
        QObject.connect(saveAllAction, SIGNAL("triggered()"),
                        main.save_project)
        QObject.connect(openProjectAction, SIGNAL("triggered()"),
                        main.open_project_folder)
        QObject.connect(openProjectTypeAction, SIGNAL("triggered()"),
                        self._open_project_type)
        QObject.connect(closeAction, SIGNAL("triggered()"),
                        main.close_actual_tab)
        QObject.connect(exitAction, SIGNAL("triggered()"),
                        QCoreApplication.quit)
        QObject.connect(reloadFileAction, SIGNAL("triggered()"),
                        main.reload_file)
        QObject.connect(printFile, SIGNAL("triggered()"), main._print_file)
Example #37
0
    def setupUi(self, tarjeta_ui):
        tarjeta_ui.setObjectName(_fromUtf8(u"tarjeta_ui"))
        tarjeta_ui.resize(1873, 1038)
        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(tarjeta_ui.sizePolicy().hasHeightForWidth())
        tarjeta_ui.setSizePolicy(sizePolicy)
        self.horizontalLayout = QtGui.QHBoxLayout(tarjeta_ui)
        self.horizontalLayout.setObjectName(_fromUtf8(u"horizontalLayout"))
        self.tab_object_main = QtGui.QTabWidget(tarjeta_ui)
        self.tab_object_main.setObjectName(_fromUtf8(u"tab_object_main"))
        self.tab_import_words = QtGui.QWidget()
        self.tab_import_words.setObjectName(_fromUtf8(u"tab_import_words"))
        self.gridLayout = QtGui.QGridLayout(self.tab_import_words)
        self.gridLayout.setObjectName(_fromUtf8(u"gridLayout"))
        self.scroll_area_import_words = QtGui.QScrollArea(self.tab_import_words)
        self.scroll_area_import_words.setWidgetResizable(True)
        self.scroll_area_import_words.setObjectName(_fromUtf8(u"scroll_area_import_words"))
        self.scrollAreaWidgetContents = QtGui.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1829, 974))
        self.scrollAreaWidgetContents.setObjectName(_fromUtf8(u"scrollAreaWidgetContents"))
        self.gridLayout_6 = QtGui.QGridLayout(self.scrollAreaWidgetContents)
        self.gridLayout_6.setObjectName(_fromUtf8(u"gridLayout_6"))
        self.text_edit_import_words = QtGui.QTextEdit(self.scrollAreaWidgetContents)
        self.text_edit_import_words.setObjectName(_fromUtf8(u"text_edit_import_words"))
        self.gridLayout_6.addWidget(self.text_edit_import_words, 0, 0, 1, 1)
        self.push_button_save_words = QtGui.QPushButton(self.scrollAreaWidgetContents)
        self.push_button_save_words.setObjectName(_fromUtf8(u"push_button_save_words"))
        self.gridLayout_6.addWidget(self.push_button_save_words, 0, 1, 1, 1)
        self.scroll_area_import_words.setWidget(self.scrollAreaWidgetContents)
        self.gridLayout.addWidget(self.scroll_area_import_words, 0, 0, 1, 1)
        self.tab_object_main.addTab(self.tab_import_words, _fromUtf8(u""))
        self.tab_create_cards = QtGui.QWidget()
        self.tab_create_cards.setObjectName(_fromUtf8(u"tab_create_cards"))
        self.gridLayout_2 = QtGui.QGridLayout(self.tab_create_cards)
        self.gridLayout_2.setObjectName(_fromUtf8(u"gridLayout_2"))
        self.label_front = QtGui.QLabel(self.tab_create_cards)
        self.label_front.setObjectName(_fromUtf8(u"label_front"))
        self.gridLayout_2.addWidget(self.label_front, 0, 1, 1, 1)
        self.label_back = QtGui.QLabel(self.tab_create_cards)
        self.label_back.setObjectName(_fromUtf8(u"label_back"))
        self.gridLayout_2.addWidget(self.label_back, 2, 1, 1, 1)
        self.push_button_add_card = QtGui.QPushButton(self.tab_create_cards)
        self.push_button_add_card.setObjectName(_fromUtf8(u"push_button_add_card"))
        self.gridLayout_2.addWidget(self.push_button_add_card, 4, 0, 1, 1)
        self.tabWidget_2 = QtGui.QTabWidget(self.tab_create_cards)
        self.tabWidget_2.setObjectName(_fromUtf8(u"tabWidget_2"))
        self.tab_spanishdict = QtGui.QWidget()
        self.tab_spanishdict.setObjectName(_fromUtf8(u"tab_spanishdict"))
        self.gridLayout_3 = QtGui.QGridLayout(self.tab_spanishdict)
        self.gridLayout_3.setObjectName(_fromUtf8(u"gridLayout_3"))
        self.text_browser_spanish_dict = QtGui.QTextBrowser(self.tab_spanishdict)
        self.text_browser_spanish_dict.setObjectName(_fromUtf8(u"text_browser_spanish_dict"))
        self.gridLayout_3.addWidget(self.text_browser_spanish_dict, 0, 0, 1, 1)
        self.tabWidget_2.addTab(self.tab_spanishdict, _fromUtf8(u""))
        self.tab_dle = QtGui.QWidget()
        self.tab_dle.setObjectName(_fromUtf8(u"tab_dle"))
        self.gridLayout_4 = QtGui.QGridLayout(self.tab_dle)
        self.gridLayout_4.setObjectName(_fromUtf8(u"gridLayout_4"))
        self.text_browser_dle = QtGui.QTextBrowser(self.tab_dle)
        self.text_browser_dle.setObjectName(_fromUtf8(u"text_browser_dle"))
        self.gridLayout_4.addWidget(self.text_browser_dle, 0, 0, 1, 1)
        self.tabWidget_2.addTab(self.tab_dle, _fromUtf8(u""))
        self.tab_wordreference = QtGui.QWidget()
        self.tab_wordreference.setObjectName(_fromUtf8(u"tab_wordreference"))
        self.gridLayout_5 = QtGui.QGridLayout(self.tab_wordreference)
        self.gridLayout_5.setObjectName(_fromUtf8(u"gridLayout_5"))
        self.text_browser_wordreference = QtGui.QTextBrowser(self.tab_wordreference)
        self.text_browser_wordreference.setObjectName(_fromUtf8(u"text_browser_wordreference"))
        self.gridLayout_5.addWidget(self.text_browser_wordreference, 0, 0, 1, 1)
        self.tabWidget_2.addTab(self.tab_wordreference, _fromUtf8(u""))
        self.gridLayout_2.addWidget(self.tabWidget_2, 1, 0, 3, 1)
        self.text_edit_card_front = QtGui.QTextEdit(self.tab_create_cards)
        self.text_edit_card_front.setObjectName(_fromUtf8(u"text_edit_card_back"))
        self.gridLayout_2.addWidget(self.text_edit_card_front, 1, 1, 1, 1)
        self.text_edit_card_back = QtGui.QTextEdit(self.tab_create_cards)
        self.text_edit_card_back.setLineWrapMode(QtGui.QTextEdit.WidgetWidth)
        self.text_edit_card_back.setObjectName(_fromUtf8(u"textEdit_3"))
        self.gridLayout_2.addWidget(self.text_edit_card_back, 3, 1, 1, 1)
        self.push_button_write_word = QtGui.QPushButton(self.tab_create_cards)
        self.push_button_write_word.setObjectName(_fromUtf8(u"push_button_write_word"))
        self.gridLayout_2.addWidget(self.push_button_write_word, 5, 1, 1, 1)
        self.push_button_next_word = QtGui.QPushButton(self.tab_create_cards)
        self.push_button_next_word.setObjectName(_fromUtf8(u"push_button_next_word"))
        self.gridLayout_2.addWidget(self.push_button_next_word, 4, 1, 1, 1)
        self.push_button_skip_word = QtGui.QPushButton(self.tab_create_cards)
        self.push_button_skip_word.setObjectName(_fromUtf8(u"push_button_skip_word"))
        self.gridLayout_2.addWidget(self.push_button_skip_word, 6, 1, 1, 1)
        self.gridLayout_2.setColumnStretch(0, 2)
        self.gridLayout_2.setColumnStretch(1, 1)
        self.tab_object_main.addTab(self.tab_create_cards, _fromUtf8(u""))
        self.tab_quick_lookup = QtGui.QWidget()
        self.tab_quick_lookup.setObjectName(_fromUtf8(u"tab_quick_lookup"))
        self.gridLayout_7 = QtGui.QGridLayout(self.tab_quick_lookup)
        self.gridLayout_7.setObjectName(_fromUtf8(u"gridLayout_7"))
        self.text_browser_quick_lookup = QtGui.QTextBrowser(self.tab_quick_lookup)
        self.text_browser_quick_lookup.setObjectName(_fromUtf8(u"text_browser_quick_lookup"))
        self.gridLayout_7.addWidget(self.text_browser_quick_lookup, 1, 0, 1, 1)
        self.inline_edit_quicklook = QtGui.QLineEdit(self.tab_quick_lookup)
        self.inline_edit_quicklook.setObjectName(_fromUtf8(u"inline_edit_quicklook"))
        self.gridLayout_7.addWidget(self.inline_edit_quicklook, 1, 1, 1, 1)
        self.push_button_lookup = QtGui.QPushButton(self.tab_quick_lookup)
        self.push_button_lookup.setObjectName(_fromUtf8(u"push_button_lookup"))
        self.gridLayout_7.addWidget(self.push_button_lookup, 2, 1, 1, 1)
        self.label_quicklook_word = QtGui.QLabel(self.tab_quick_lookup)
        self.label_quicklook_word.setObjectName(_fromUtf8(u"label_quicklook_word"))
        self.gridLayout_7.addWidget(self.label_quicklook_word, 0, 1, 1, 1)
        self.push_button_add_to_list = QtGui.QPushButton(self.tab_quick_lookup)
        self.push_button_add_to_list.setObjectName(_fromUtf8(u"push_button_add_to_list"))
        self.gridLayout_7.addWidget(self.push_button_add_to_list, 3, 1, 1, 1)
        self.gridLayout_7.setColumnStretch(0, 2)
        self.gridLayout_7.setColumnStretch(1, 1)
        self.tab_object_main.addTab(self.tab_quick_lookup, _fromUtf8(u""))
        self.horizontalLayout.addWidget(self.tab_object_main)

        self.retranslateUi(tarjeta_ui)
        self.tab_object_main.setCurrentIndex(2)
        self.tabWidget_2.setCurrentIndex(2)
        QtCore.QMetaObject.connectSlotsByName(tarjeta_ui)

        QObject.connect(self.push_button_save_words, SIGNAL(u"clicked()"), self._save_words)
        QObject.connect(self.push_button_next_word, SIGNAL(u"clicked()"), self._create_card)
        QObject.connect(self.push_button_write_word, SIGNAL(u"clicked()"), self._write_word)
        QObject.connect(self.push_button_lookup, SIGNAL(u"clicked()"), self._quick_lookup)
        QObject.connect(self.push_button_add_to_list, SIGNAL(u"clicked()"), self._add_to_list)
        QObject.connect(self.push_button_skip_word, SIGNAL(u"clicked()"), self._skip_word)
        QObject.connect(self.push_button_skip_word, SIGNAL(u"clicked()"), self._skip_word)

        ###########################################
        # Import cards                            #
        ###########################################
        if len(self.list) != 0:
            for word in self.list:
                self.text_edit_import_words.insertPlainText(word + u'\n')
        else:
            if os.path.isfile(u"word_list"):
                with open(u"word_list", encoding=u"utf-8") as f:
                    for word in f.readlines():
                        word = word.strip()

                        # This try except block eliminates blank spaces that shouldn't be there
                        try:
                            if word[0].isalpha():
                                self.list.append(word)
                                self.text_edit_import_words.insertPlainText(word + u"\n")
                        except IndexError:
                            pass
            else:
                self.text_edit_import_words.insertPlainText(u"Add words here. One on each line.")
Example #38
0
 def addDockWidget(self, widget):
     dockwidget = MDockWidget(self.__mainWindow, widget, widget.name)
     QObject.connect(dockwidget, SIGNAL("resizeEvent"), widget.resize)
     self.__mainWindow.addNewDockWidgetTab(Qt.RightDockWidgetArea,
                                           dockwidget)
Example #39
0
    def accept(self):
        if self.inputFiles is None:
            workDir = QDir(self.leInputDir.text())
            workDir.setFilter(QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot)
            nameFilter = ["*.shp", "*.SHP"]
            workDir.setNameFilters(nameFilter)
            self.inputFiles = workDir.entryList()
            if len(self.inputFiles) == 0:
                QMessageBox.warning(
                    self, self.tr("No shapefiles found"),
                    self.tr("There are no shapefiles in this directory. Please select another one."))
                self.inputFiles = None
                return

        if self.outFileName is None:
            QMessageBox.warning(
                self, self.tr("No output file"),
                self.tr("Please specify output file."))
            return

        if self.chkListMode.isChecked():
            files = self.leInputDir.text().split(";")
            baseDir = QFileInfo(files[0]).absolutePath()
        else:
            baseDir = self.leInputDir.text()
            # look for shapes with specified geometry type
            self.inputFiles = ftools_utils.getShapesByGeometryType(baseDir, self.inputFiles, self.cmbGeometry.currentIndex())
            if self.inputFiles is None:
                QMessageBox.warning(
                    self, self.tr("No shapefiles found"),
                    self.tr("There are no shapefiles with the given geometry type. Please select an available geometry type."))
                return
            self.progressFiles.setRange(0, len(self.inputFiles))

        outFile = QFile(self.outFileName)
        if outFile.exists():
            if not QgsVectorFileWriter.deleteShapeFile(self.outFileName):
                QMessageBox.warning(self, self.tr("Delete error"), self.tr("Can't delete file %s") % (self.outFileName))
                return

        if self.inEncoding is None:
            self.inEncoding = "System"

        self.btnOk.setEnabled(False)

        self.mergeThread = ShapeMergeThread(baseDir, self.inputFiles, self.inEncoding, self.outFileName, self.encoding)
        QObject.connect(self.mergeThread, SIGNAL("rangeChanged( PyQt_PyObject )"), self.setFeatureProgressRange)
        QObject.connect(self.mergeThread, SIGNAL("checkStarted()"), self.setFeatureProgressFormat)
        QObject.connect(self.mergeThread, SIGNAL("checkFinished()"), self.resetFeatureProgressFormat)
        QObject.connect(self.mergeThread, SIGNAL("fileNameChanged( PyQt_PyObject )"), self.setShapeProgressFormat)
        QObject.connect(self.mergeThread, SIGNAL("featureProcessed()"), self.featureProcessed)
        QObject.connect(self.mergeThread, SIGNAL("shapeProcessed()"), self.shapeProcessed)
        QObject.connect(self.mergeThread, SIGNAL("processingFinished()"), self.processingFinished)
        QObject.connect(self.mergeThread, SIGNAL("processingInterrupted()"), self.processingInterrupted)

        self.btnClose.setText(self.tr("Cancel"))
        QObject.disconnect(self.buttonBox, SIGNAL("rejected()"), self.reject)
        QObject.connect(self.btnClose, SIGNAL("clicked()"), self.stopProcessing)

        self.mergeThread.start()
Example #40
0
    def createWidgets(self):
        """Mise en place du masquage des frames et des connections de l'interface"""
        self.ui = self
        self.ui.setupUi(self)
        self.ui.setFocus(True)

        ## Initialisation des frames et bouttons
        self.ui.runPushButton.setDisabled(True)
        self.ui.frameRun.hide()

        # add to mainparams and extraparams
        self.actualizeSTRUCTUREColor()

        #self.ui.progressbar.hide()
        self.setWindowIcon(QIcon(resource_path("./includes/icon.ico")))
        self.ui.statusbar.setStyleSheet(
            "color: rgb(255, 107, 8);font: 10pt 'Arial Black';")

        self.resizeWindows()

        ## Edition des connect:
        QObject.connect(self.ui.loadMatriceFilePushButton, SIGNAL("clicked()"),
                        self.loadMatriceFile)

        QObject.connect(self.ui.resetPushButton, SIGNAL("clicked()"),
                        self.resetPress)
        QObject.connect(self.ui.runPushButton, SIGNAL("clicked()"), self.run)

        QObject.connect(self.ui.updateColorPushButton, SIGNAL("clicked()"),
                        self.actualizeSTRUCTUREColor)

        QObject.connect(self.ui.rmOldCheckBox, SIGNAL("stateChanged(int)"),
                        self.actualizeRmOld)

        QObject.connect(self.ui.indivLineEdit, SIGNAL("editingFinished()"),
                        self.actualizeIndiv)
        QObject.connect(self.ui.markerLineEdit, SIGNAL("editingFinished()"),
                        self.actualizeMarker)

        QObject.connect(self.ui.popMinLineEdit, SIGNAL("editingFinished()"),
                        self.actualizePopMin)
        QObject.connect(self.ui.popMaxLineEdit, SIGNAL("editingFinished()"),
                        self.actualizePopMax)

        QObject.connect(self.ui.repMinLineEdit, SIGNAL("editingFinished()"),
                        self.actualizeRepMin)
        QObject.connect(self.ui.repMaxLineEdit, SIGNAL("editingFinished()"),
                        self.actualizeRepMax)
Example #41
0
 def connectAll(self):
     for person in self._listPerson:
         QObject.connect(person[S.birth], SIGNAL('dateChanged(QDate)'),
                         self.birthChanged)
         QObject.connect(person[S.decpos],
                         SIGNAL('currentIndexChanged(QString)'),
                         self.quifoyChanged)
         QObject.connect(person[S.decnum],
                         SIGNAL('currentIndexChanged(int)'),
                         self.foyerChanged)
         QObject.connect(person[S.fampos],
                         SIGNAL('currentIndexChanged(QString)'),
                         self.quifamChanged)
         QObject.connect(person[S.famnum],
                         SIGNAL('currentIndexChanged(int)'),
                         self.familleChanged)
         QObject.connect(person[S.decbtn], SIGNAL('clicked()'),
                         self.openDeclaration)
Example #42
0
    def __init__(self):
        QWidget.__init__(self)
        Ui_MainScreen.__init__(self)
        self.setupUi(self)

        self.settings = Settings()
        self.restoreSettingsFromConfig()
        # quit app from settings window
        self.settings.sigExitOAS.connect(self.exitOAS)
        self.settings.sigRebootHost.connect(self.reboot_host)
        self.settings.sigShutdownHost.connect(self.shutdown_host)
        self.settings.sigConfigFinished.connect(self.configFinished)

        settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
        settings.beginGroup("General")
        if settings.value('fullscreen', True).toBool():
            self.showFullScreen()
            app.setOverrideCursor(QCursor(10))
        settings.endGroup()

        self.labelWarning.hide()

        # add hotkey bindings
        QShortcut(QKeySequence("Ctrl+F"), self, self.toggleFullScreen)
        QShortcut(QKeySequence("F"), self, self.toggleFullScreen)
        QShortcut(QKeySequence(16777429), self,
                  self.toggleFullScreen)  # 'Display' Key on OAS USB Keyboard
        QShortcut(QKeySequence(16777379), self,
                  self.shutdown_host)  # 'Calculator' Key on OAS USB Keyboard
        QShortcut(QKeySequence("Ctrl+Q"), self,
                  QCoreApplication.instance().quit)
        QShortcut(QKeySequence("Q"), self, QCoreApplication.instance().quit)
        QShortcut(QKeySequence("Ctrl+C"), self,
                  QCoreApplication.instance().quit)
        QShortcut(QKeySequence("ESC"), self, QCoreApplication.instance().quit)
        QShortcut(QKeySequence("Ctrl+S"), self, self.showsettings)
        QShortcut(QKeySequence("Ctrl+,"), self, self.showsettings)
        QShortcut(QKeySequence(" "), self, self.radioTimerStartStop)
        QShortcut(QKeySequence(","), self, self.radioTimerStartStop)
        QShortcut(QKeySequence("."), self, self.radioTimerStartStop)
        QShortcut(QKeySequence("0"), self, self.radioTimerReset)
        QShortcut(QKeySequence("R"), self, self.radioTimerReset)
        QShortcut(QKeySequence("1"), self, self.toggleLED1)
        QShortcut(QKeySequence("2"), self, self.toggleLED2)
        QShortcut(QKeySequence("3"), self, self.toggleLED3)
        QShortcut(QKeySequence("4"), self, self.toggleLED4)
        QShortcut(QKeySequence("M"), self, self.toggleAIR1)
        QShortcut(QKeySequence("/"), self, self.toggleAIR1)
        QShortcut(QKeySequence("P"), self, self.toggleAIR2)
        QShortcut(QKeySequence("*"), self, self.toggleAIR2)
        QShortcut(QKeySequence("S"), self, self.toggleAIR4)
        QShortcut(QKeySequence("Enter"), self, self.getTimerDialog)
        QShortcut(QKeySequence("Return"), self, self.getTimerDialog)

        # Setup and start timers
        self.ctimer = QTimer()
        QObject.connect(self.ctimer, SIGNAL("timeout()"), self.constantUpdate)
        self.ctimer.start(100)
        # LED timers
        self.timerLED1 = QTimer()
        QObject.connect(self.timerLED1, SIGNAL("timeout()"), self.toggleLED1)
        self.timerLED2 = QTimer()
        QObject.connect(self.timerLED2, SIGNAL("timeout()"), self.toggleLED2)
        self.timerLED3 = QTimer()
        QObject.connect(self.timerLED3, SIGNAL("timeout()"), self.toggleLED3)
        self.timerLED4 = QTimer()
        QObject.connect(self.timerLED4, SIGNAL("timeout()"), self.toggleLED4)

        # Setup OnAir Timers
        self.timerAIR1 = QTimer()
        QObject.connect(self.timerAIR1, SIGNAL("timeout()"),
                        self.updateAIR1Seconds)
        self.Air1Seconds = 0
        self.statusAIR1 = False

        self.timerAIR2 = QTimer()
        QObject.connect(self.timerAIR2, SIGNAL("timeout()"),
                        self.updateAIR2Seconds)
        self.Air2Seconds = 0
        self.statusAIR2 = False

        self.timerAIR3 = QTimer()
        QObject.connect(self.timerAIR3, SIGNAL("timeout()"),
                        self.updateAIR3Seconds)
        self.Air3Seconds = 0
        self.statusAIR3 = False
        self.radioTimerMode = 0  #count up mode

        self.timerAIR4 = QTimer()
        QObject.connect(self.timerAIR4, SIGNAL("timeout()"),
                        self.updateAIR4Seconds)
        self.Air4Seconds = 0
        self.statusAIR4 = False
        self.streamTimerMode = 0  #count up mode

        # Setup check NTP Timer
        self.ntpHadWarning = True
        self.timerNTP = QTimer()
        QObject.connect(self.timerNTP, SIGNAL("timeout()"),
                        self.checkNTPOffset)
        # initial check
        self.timerNTP.start(5000)

        # Setup UDP Socket
        self.udpsock = QUdpSocket()
        settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
        settings.beginGroup("Network")
        (port, foo) = settings.value('udpport', 3310).toInt()
        settings.endGroup()
        self.udpsock.bind(port, QUdpSocket.ShareAddress)
        self.udpsock.readyRead.connect(self.cmdHandler)

        # diplay all host adresses
        self.displayAllHostaddresses()

        # set NTP warning
        settings = QSettings(QSettings.UserScope, "astrastudio", "OnAirScreen")
        settings.beginGroup("NTP")
        if settings.value('ntpcheck', True).toBool():
            self.showWarning("Clock NTP status unknown")
        settings.endGroup()
Example #43
0
    def __init__(self, menuView, toolbar, ide):
        QObject.__init__(self)
        self.__ide = ide

        self.hideConsoleAction = menuView.addAction(
            self.tr("Show/Hide &Console (%s)" %
                    resources.get_shortcut("Hide-misc").toString(
                        QKeySequence.NativeText)))
        self.hideConsoleAction.setCheckable(True)
        self.hideEditorAction = menuView.addAction(
            self.tr("Show/Hide &Editor (%s)" %
                    resources.get_shortcut("Hide-editor").toString(
                        QKeySequence.NativeText)))
        self.hideEditorAction.setCheckable(True)
        self.hideAllAction = menuView.addAction(
            self.tr("Show/Hide &All (%s)" %
                    resources.get_shortcut("Hide-all").toString(
                        QKeySequence.NativeText)))
        self.hideAllAction.setCheckable(True)
        self.hideExplorerAction = menuView.addAction(
            self.tr("Show/Hide &Explorer (%s)" %
                    resources.get_shortcut("Hide-explorer").toString(
                        QKeySequence.NativeText)))
        self.hideExplorerAction.setCheckable(True)
        self.hideToolbarAction = menuView.addAction(
            self.tr("Show/Hide &Toolbar"))
        self.hideToolbarAction.setCheckable(True)
        self.fullscreenAction = menuView.addAction(
            QIcon(resources.IMAGES['fullscreen']),
            self.tr(u"Full Screen &Mode (%s)".format(
                resources.get_shortcut("Full-screen").toString(
                    QKeySequence.NativeText))))
        menuView.addSeparator()
        splitTabHAction = menuView.addAction(
            QIcon(resources.IMAGES['splitH']),
            self.tr("Split Tabs Horizontally (%s)" %
                    resources.get_shortcut("Split-horizontal").toString(
                        QKeySequence.NativeText)))
        splitTabVAction = menuView.addAction(
            QIcon(resources.IMAGES['splitV']),
            self.tr("Split Tabs Vertically (%s)" %
                    resources.get_shortcut("Split-vertical").toString(
                        QKeySequence.NativeText)))
        followModeAction = menuView.addAction(
            QIcon(resources.IMAGES['follow']),
            self.tr(u"Follow Mode (%s)".format(
                resources.get_shortcut("Follow-mode").toString(
                    QKeySequence.NativeText))))
        groupTabsAction = menuView.addAction(self.tr("Group Tabs by Project"))
        deactivateGroupTabsAction = menuView.addAction(
            self.tr("Deactivate Group Tabs"))
        menuView.addSeparator()
        #Zoom
        zoomInAction = menuView.addAction(QIcon(resources.IMAGES['zoom-in']),
                                          self.tr("Zoom &In (Shift+Wheel-Up)"))
        zoomOutAction = menuView.addAction(
            QIcon(resources.IMAGES['zoom-out']),
            self.tr("Zoom &Out (Shift+Wheel-Down)"))
        menuView.addSeparator()
        fadeInAction = menuView.addAction(self.tr("Fade In (Alt+Wheel-Up)"))
        fadeOutAction = menuView.addAction(
            self.tr("Fade Out (Alt+Wheel-Down)"))

        self.toolbar_items = {
            'splith': splitTabHAction,
            'splitv': splitTabVAction,
            'follow-mode': followModeAction,
            'zoom-in': zoomInAction,
            'zoom-out': zoomOutAction
        }

        self.connect(self.hideConsoleAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_misc_visibility)
        self.connect(self.hideEditorAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_main_visibility)
        self.connect(self.hideExplorerAction, SIGNAL("triggered()"),
                     self.__ide.actions.view_explorer_visibility)
        self.connect(self.hideAllAction, SIGNAL("triggered()"),
                     self.__ide.actions.hide_all)
        self.connect(self.fullscreenAction, SIGNAL("triggered()"),
                     self.__ide.actions.fullscreen_mode)

        self.connect(splitTabHAction, SIGNAL("triggered()"),
                     lambda: self.__ide.mainContainer.split_tab(True))
        self.connect(splitTabVAction, SIGNAL("triggered()"),
                     lambda: self.__ide.mainContainer.split_tab(False))
        QObject.connect(followModeAction, SIGNAL("triggered()"),
                        self.__ide.mainContainer.show_follow_mode)
        self.connect(zoomInAction, SIGNAL("triggered()"), self.zoom_in_editor)
        self.connect(zoomOutAction, SIGNAL("triggered()"),
                     self.zoom_out_editor)
        self.connect(fadeInAction, SIGNAL("triggered()"), self._fade_in)
        self.connect(fadeOutAction, SIGNAL("triggered()"), self._fade_out)
        self.connect(self.hideToolbarAction, SIGNAL("triggered()"),
                     self._hide_show_toolbar)
        self.connect(groupTabsAction, SIGNAL("triggered()"),
                     self.__ide.actions.group_tabs_together)
        self.connect(deactivateGroupTabsAction, SIGNAL("triggered()"),
                     self.__ide.actions.deactivate_tabs_groups)

        #Set proper MenuView checks values:
        self.hideAllAction.setChecked(True)
        self.hideConsoleAction.setChecked(False)
        self.hideEditorAction.setChecked(True)
        self.hideExplorerAction.setChecked(True)
        self.hideToolbarAction.setChecked(True)
Example #44
0
    def initGui(self):
        """Gui initialisation procedure (for QGIS plugin api).

        .. note:: Don't change the name of this method from initGui!

        This method is called by QGIS and should be used to set up
        any graphical user interface elements that should appear in QGIS by
        default (i.e. before the user performs any explicit action with the
        plugin).
        """
        self.toolbar = self.iface.addToolBar('InaSAFE')
        self.toolbar.setObjectName('InaSAFEToolBar')
        # Import dock here as it needs to be imported AFTER i18n is set up
        from safe_qgis.widgets.dock import Dock
        self.dockWidget = None
        #--------------------------------------
        # Create action for plugin dockable window (show/hide)
        #--------------------------------------
        # pylint: disable=W0201
        self.actionDock = QAction(QIcon(':/plugins/inasafe/icon.svg'),
                                  self.tr('Toggle InaSAFE Dock'),
                                  self.iface.mainWindow())
        self.actionDock.setObjectName('InaSAFEDockToggle')
        self.actionDock.setStatusTip(self.tr('Show/hide InaSAFE dock widget'))
        self.actionDock.setWhatsThis(self.tr('Show/hide InaSAFE dock widget'))
        self.actionDock.setCheckable(True)
        self.actionDock.setChecked(True)
        QObject.connect(self.actionDock, SIGNAL('triggered()'),
                        self.toggle_dock_visibility)
        self.add_action(self.actionDock)

        #--------------------------------------
        # Create action for keywords editor
        #--------------------------------------
        self.actionKeywordsDialog = QAction(
            QIcon(':/plugins/inasafe/show-keyword-editor.svg'),
            self.tr('InaSAFE Keyword Editor'), self.iface.mainWindow())
        self.actionKeywordsDialog.setStatusTip(
            self.tr('Open InaSAFE keywords editor'))
        self.actionKeywordsDialog.setWhatsThis(
            self.tr('Open InaSAFE keywords editor'))
        self.actionKeywordsDialog.setEnabled(False)

        QObject.connect(self.actionKeywordsDialog, SIGNAL('triggered()'),
                        self.show_keywords_editor)

        self.add_action(self.actionKeywordsDialog)

        #--------------------------------------
        # Create action for reset icon
        #--------------------------------------
        self.actionResetDock = QAction(
            QIcon(':/plugins/inasafe/reset-dock.svg'), self.tr('Reset Dock'),
            self.iface.mainWindow())
        self.actionResetDock.setStatusTip(self.tr('Reset the InaSAFE Dock'))
        self.actionResetDock.setWhatsThis(self.tr('Reset the InaSAFE Dock'))
        QObject.connect(self.actionResetDock, SIGNAL('triggered()'),
                        self.reset_dock)

        self.add_action(self.actionResetDock)

        #--------------------------------------
        # Create action for options dialog
        #--------------------------------------
        self.actionOptions = QAction(
            QIcon(':/plugins/inasafe/configure-inasafe.svg'),
            self.tr('InaSAFE Options'), self.iface.mainWindow())
        self.actionOptions.setStatusTip(self.tr('Open InaSAFE options dialog'))
        self.actionOptions.setWhatsThis(self.tr('Open InaSAFE options dialog'))
        QObject.connect(self.actionOptions, SIGNAL('triggered()'),
                        self.show_options)

        self.add_action(self.actionOptions)

        #--------------------------------------
        # Create action for impact functions doc dialog
        #--------------------------------------
        self.actionImpactFunctionsDoc = QAction(
            QIcon(':/plugins/inasafe/show-impact-functions.svg'),
            self.tr('InaSAFE Impact Functions Browser'),
            self.iface.mainWindow())
        self.actionImpactFunctionsDoc.setStatusTip(
            self.tr('Open InaSAFE Impact Functions Browser'))
        self.actionImpactFunctionsDoc.setWhatsThis(
            self.tr('Open InaSAFE Impact Functions Browser'))
        QObject.connect(self.actionImpactFunctionsDoc, SIGNAL('triggered()'),
                        self.show_function_browser)

        self.add_action(self.actionImpactFunctionsDoc)

        # Short cut for Open Impact Functions Doc
        self.keyAction = QAction("Test Plugin", self.iface.mainWindow())
        self.iface.registerMainWindowAction(self.keyAction, "F7")
        QObject.connect(self.keyAction, SIGNAL("triggered()"),
                        self.shortcut_f7)

        #---------------------------------------
        # Create action for minimum needs dialog
        #---------------------------------------
        self.actionMinimumNeeds = QAction(
            QIcon(':/plugins/inasafe/show-minimum-needs.svg'),
            self.tr('InaSAFE Minimum Needs Tool'), self.iface.mainWindow())
        self.actionMinimumNeeds.setStatusTip(
            self.tr('Open InaSAFE minimum needs tool'))
        self.actionMinimumNeeds.setWhatsThis(
            self.tr('Open InaSAFE minimum needs tool'))
        QObject.connect(self.actionMinimumNeeds, SIGNAL('triggered()'),
                        self.show_minimum_needs)

        self.add_action(self.actionMinimumNeeds)

        #---------------------------------------
        # Create action for converter dialog
        #---------------------------------------
        self.actionConverter = QAction(
            QIcon(':/plugins/inasafe/show-converter-tool.svg'),
            self.tr('InaSAFE Converter'), self.iface.mainWindow())
        self.actionConverter.setStatusTip(self.tr('Open InaSAFE Converter'))
        self.actionConverter.setWhatsThis(self.tr('Open InaSAFE Converter'))
        QObject.connect(self.actionConverter, SIGNAL('triggered()'),
                        self.show_shakemap_importer)

        self.add_action(self.actionConverter)

        #---------------------------------------
        # Create action for batch runner dialog
        #---------------------------------------
        self.actionBatchRunner = QAction(
            QIcon(':/plugins/inasafe/show-batch-runner.svg'),
            self.tr('InaSAFE Batch Runner'), self.iface.mainWindow())
        self.actionBatchRunner.setStatusTip(
            self.tr('Open InaSAFE Batch Runner'))
        self.actionBatchRunner.setWhatsThis(
            self.tr('Open InaSAFE Batch Runner'))
        QObject.connect(self.actionBatchRunner, SIGNAL('triggered()'),
                        self.show_batch_runner)

        self.add_action(self.actionBatchRunner)

        #---------------------------------------
        # Create action for batch runner dialog
        #---------------------------------------
        self.actionSaveScenario = QAction(
            QIcon(':/plugins/inasafe/save-as-scenario.svg'),
            self.tr('Save current scenario'), self.iface.mainWindow())

        myMessage = self.tr('Save current scenario to text file')
        self.actionSaveScenario.setStatusTip(myMessage)
        self.actionSaveScenario.setWhatsThis(myMessage)
        self.actionSaveScenario.triggered.connect(self.save_scenario)

        self.add_action(self.actionSaveScenario)

        #--------------------------------------
        # Create action for import OSM Dialog
        #--------------------------------------
        self.actionImportDlg = QAction(
            QIcon(':/plugins/inasafe/show-osm-download.svg'),
            self.tr('InaSAFE OpenStreetMap Downloader'),
            self.iface.mainWindow())
        self.actionImportDlg.setStatusTip(
            self.tr('InaSAFE OpenStreetMap Downloader'))
        self.actionImportDlg.setWhatsThis(
            self.tr('InaSAFE OpenStreetMap Downloader'))
        QObject.connect(self.actionImportDlg, SIGNAL('triggered()'),
                        self.show_osm_downloader)

        self.add_action(self.actionImportDlg)

        #--------------------------------------
        # create dockwidget and tabify it with the legend
        #--------------------------------------
        self.dockWidget = Dock(self.iface)
        self.iface.addDockWidget(Qt.RightDockWidgetArea, self.dockWidget)
        myLegendTab = self.iface.mainWindow().findChild(QApplication, 'Legend')

        if myLegendTab:
            self.iface.mainWindow().tabifyDockWidget(myLegendTab,
                                                     self.dockWidget)
            self.dockWidget.raise_()

        #
        # Hook up a slot for when the dock is hidden using its close button
        # or  view-panels
        #
        QObject.connect(self.dockWidget, SIGNAL("visibilityChanged (bool)"),
                        self.toggle_inasafe_action)
Example #45
0
    def __init__(self, hasScanner=True):
        QMainWindow.__init__(self)

        self.curDir = ""
        self.ui = Ui_Lector()
        self.ui.setupUi(self)

        self.ocrWidget = QOcrWidget("eng", 1, self.statusBar())

        self.textEditor = TextWidget()
        self.textEditorBar = EditorBar()
        self.textEditorBar.saveDocAsSignal.connect(self.textEditor.saveAs)
        self.textEditorBar.spellSignal.connect(self.textEditor.toggleSpell)
        self.textEditorBar.whiteSpaceSignal.connect(
            self.textEditor.togglewhiteSpace)
        self.textEditorBar.boldSignal.connect(self.textEditor.toggleBold)
        self.textEditorBar.italicSignal.connect(self.textEditor.toggleItalic)
        self.textEditorBar.underlineSignal.connect(
            self.textEditor.toggleUnderline)
        self.textEditorBar.strikethroughSignal.connect(
            self.textEditor.toggleStrikethrough)
        self.textEditorBar.subscriptSignal.connect(
            self.textEditor.toggleSubscript)
        self.textEditorBar.superscriptSignal.connect(
            self.textEditor.toggleSuperscript)
        self.textEditor.fontFormatSignal.connect(
            self.textEditorBar.toggleFormat)

        self.ui.mwTextEditor.addToolBar(self.textEditorBar)
        self.ui.mwTextEditor.setCentralWidget(self.textEditor)
        self.ocrWidget.textEditor = self.textEditor

        self.setCentralWidget(self.ocrWidget)

        QObject.connect(self.ui.actionRotateRight, SIGNAL("triggered()"),
                        self.ocrWidget.rotateRight)
        QObject.connect(self.ui.actionRotateLeft, SIGNAL("triggered()"),
                        self.ocrWidget.rotateLeft)
        QObject.connect(self.ui.actionRotateFull, SIGNAL("triggered()"),
                        self.ocrWidget.rotateFull)
        QObject.connect(self.ui.actionZoomIn, SIGNAL("triggered()"),
                        self.ocrWidget.zoomIn)
        QObject.connect(self.ui.actionZoomOut, SIGNAL("triggered()"),
                        self.ocrWidget.zoomOut)
        QObject.connect(self.ui.actionOcr, SIGNAL("triggered()"),
                        self.ocrWidget.doOcr)
        QObject.connect(self.ocrWidget.scene(),
                        SIGNAL("changedSelectedAreaType(int)"),
                        self.changedSelectedAreaType)

        try:
            languages = list(get_tesseract_languages())
        except TypeError:  #tesseract is not installed
            #TODO: replace QMessageBox.warning with QErrorMessage (but we need
            #      to keep state
            #dialog = QErrorMessage(self)
            #dialog.showMessage(
            #    self.tr("tessaract not available. Please check requirements"))
            QMessageBox.warning(
                self, "Tesseract",
                self.tr("Tessaract not available. Please check requirements."))
            self.ocrAvailable = False
            self.on_actionSettings_triggered(2)
        else:
            languages.sort()

            languages_ext = {
                'bul': self.tr('Bulgarian'),
                'cat': self.tr('Catalan'),
                'ces': self.tr('Czech'),
                'chi_tra': self.tr('Chinese (Traditional)'),
                'chi_sim': self.tr('Chinese (Simplified)'),
                'dan': self.tr('Danish'),
                'dan-frak': self.tr('Danish (Fraktur)'),
                'nld': self.tr('Dutch'),
                'eng': self.tr('English'),
                'fin': self.tr('Finnish'),
                'fra': self.tr('French'),
                'deu': self.tr('German'),
                'deu-frak': self.tr('German (Fraktur)'),
                'ell': self.tr('Greek'),
                'hun': self.tr('Hungarian'),
                'ind': self.tr('Indonesian'),
                'ita': self.tr('Italian'),
                'jpn': self.tr('Japanese'),
                'kor': self.tr('Korean'),
                'lav': self.tr('Latvian'),
                'lit': self.tr('Lithuanian'),
                'nor': self.tr('Norwegian'),
                'pol': self.tr('Polish'),
                'por': self.tr('Portuguese'),
                'ron': self.tr('Romanian'),
                'rus': self.tr('Russian'),
                'slk': self.tr('Slovak'),
                'slk-frak': self.tr('Slovak (Fraktur)'),
                'slv': self.tr('Slovenian'),
                'spa': self.tr('Spanish'),
                'srp': self.tr('Serbian'),
                'swe': self.tr('Swedish'),
                'swe-frak': self.tr('Swedish (Fraktur)'),
                'tgl': self.tr('Tagalog'),
                'tur': self.tr('Turkish'),
                'ukr': self.tr('Ukrainian'),
                'vie': self.tr('Vietnamese')
            }

            for lang in languages:
                try:
                    lang_ext = languages_ext[lang]
                except KeyError:
                    continue

                self.ui.rbtn_lang_select.addItem(lang_ext, lang)
                QObject.connect(self.ui.rbtn_lang_select,
                                SIGNAL('currentIndexChanged(int)'),
                                self.changeLanguage)

        #disable useless actions until a file has been opened
        self.enableActions(False)

        ## load saved settings
        self.readSettings()

        self.ui.actionScan.setEnabled(False)
        if hasScanner:
            self.on_actionChangeDevice_triggered()
        if not self.statusBar().currentMessage():
            self.statusBar().showMessage(self.tr("Ready"), 2000)
Example #46
0
    def initValues(self):
        # Is the device streaming?
        self.is_streaming = self.hw.getDiscrete('/Mixer/Info/IsStreaming')
        log.debug("device streaming flag: %d" % (self.is_streaming))

        # Retrieve other device settings as needed and customise the UI
        # based on these options.
        self.model = self.hw.getDiscrete('/Mixer/Info/Model')
        log.debug("device model identifier: %d" % (self.model))
        self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate')
        log.debug("device sample rate: %d" % (self.sample_rate))

        # For the moment none of the "Mk3" (aka Generation-3) devices are
        # supported by ffado-mixer.
        if (self.model == MOTU_MODEL_828mk3
                or self.model == MOTU_MODEL_ULTRALITEmk3
                or self.model == MOTU_MODEL_ULTRALITEmk3_HYB
                or self.model == MOTU_MODEL_TRAVELERmk3
                or self.model == MOTU_MODEL_896HDmk3):
            log.debug(
                "Generation-3 MOTU devices are not yet supported by ffado-mixer"
            )
            return

        # The 828Mk2 has separate Mic inputs but no AES/EBU, so use the
        # AES/EBU mixer controls as "Mic" controls.  If a device comes along
        # with both mic and AES inputs this approach will have to be
        # re-thought.
        # Doing this means that on the 828Mk2, the mixer matrix elements
        # used for AES/EBU on other models are used for the Mic channels.
        # So long as the MixerChannels_828Mk2 definition in
        # motu_avdevice.cpp defines the mic channels immediately after the 8
        # analog channels we'll be right.  Note that we don't need to change
        # the matrix lookup tables (self.ChannelFaders etc) because the QT
        # controls are still named *aesebu*.
        if (self.model == MOTU_MODEL_828mkII):
            self.mix1_tab.setTabText(1, "Mic inputs")
            self.mix2_tab.setTabText(1, "Mic inputs")
            self.mix3_tab.setTabText(1, "Mic inputs")
            self.mix4_tab.setTabText(1, "Mic inputs")
        else:
            # Only the Traveler and 896HD have AES/EBU inputs, so disable the AES/EBU
            # tab for all other models.
            if (self.model != MOTU_MODEL_TRAVELER
                    and self.model != MOTU_MODEL_896HD):
                self.mix1_tab.setTabEnabled(1, False)
                self.mix2_tab.setTabEnabled(1, False)
                self.mix3_tab.setTabEnabled(1, False)
                self.mix4_tab.setTabEnabled(1, False)

        # All models except the 896HD and 8pre have SPDIF inputs.
        if (self.model == MOTU_MODEL_8PRE or self.model == MOTU_MODEL_896HD):
            self.mix1_tab.setTabEnabled(2, False)
            self.mix2_tab.setTabEnabled(2, False)
            self.mix3_tab.setTabEnabled(2, False)
            self.mix4_tab.setTabEnabled(2, False)

        # Devices without AES/EBU inputs/outputs (currently all except the
        # Traveler and 896HD) have dedicated "MainOut" outputs instead.
        # AES/EBU is normally ID 6 in the destination lists and "MainOut"
        # displaces it on non-AES/EBU models.  The 896HD has both AES/EBU
        # and MainOut which complicates this; it uses ID 6 for MainOut and
        # ID 7 (nominally SPDIF) for AES/EBU.  Therefore change ID 6 to
        # "MainOut" for everything but the Traveler, and set ID 7 (nominally
        # SPDIF) to AES/EBU for the 896HD.
        if (self.model != MOTU_MODEL_TRAVELER):
            self.mix1_dest.setItemText(6, "MainOut")
            self.mix2_dest.setItemText(6, "MainOut")
            self.mix3_dest.setItemText(6, "MainOut")
            self.mix4_dest.setItemText(6, "MainOut")
            self.phones_src.setItemText(6, "MainOut")
        if (self.model == MOTU_MODEL_896HD):
            self.mix1_dest.setItemText(7, "AES/EBU")
            self.mix2_dest.setItemText(7, "AES/EBU")
            self.mix3_dest.setItemText(7, "AES/EBU")
            self.mix4_dest.setItemText(7, "AES/EBU")
            self.phones_src.setItemText(7, "AES/EBU")

        # The Ultralite doesn't have ADAT channels (or any optical ports at
        # all)
        if (self.model == MOTU_MODEL_ULTRALITE):
            self.mix1_tab.setTabEnabled(3, False)  # ADAT page
            self.mix2_tab.setTabEnabled(3, False)  # ADAT page
            self.mix3_tab.setTabEnabled(3, False)  # ADAT page
            self.mix4_tab.setTabEnabled(3, False)  # ADAT page
            self.optical_in_mode.setEnabled(False)
            self.optical_out_mode.setEnabled(False)

        # The 896HD and 8pre don't have optical SPDIF (aka Toslink) capability
        if (self.model == MOTU_MODEL_896HD or self.model == MOTU_MODEL_8PRE):
            self.optical_in_mode.removeItem(2)
            self.optical_out_mode.removeItem(2)

        # The 8pre doesn't have software phones/main fader controls
        if (self.model == MOTU_MODEL_8PRE):
            self.disable_hide(self.mainout_fader)
            self.disable_hide(self.phones_fader)

        # Only the 896HD has meter controls
        if (self.model != MOTU_MODEL_896HD):
            self.disable_hide(self.meter_src)
            self.disable_hide(self.aesebu_meter)
            self.disable_hide(self.peakhold_time)
            self.disable_hide(self.cliphold_time)

        # Some controls must be disabled if the device is streaming
        if (self.is_streaming):
            log.debug("Disabling controls which require inactive streaming")
            self.optical_in_mode.setEnabled(False)
            self.optical_out_mode.setEnabled(False)

        # Some channels aren't available at higher sampling rates
        if (self.sample_rate > 96000):
            log.debug("Disabling controls not present above 96 kHz")
            self.mix1_tab.setTabEnabled(3, False)  # ADAT
            self.mix1_tab.setTabEnabled(2, False)  # SPDIF
            self.mix1_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix2_tab.setTabEnabled(3, False)  # ADAT
            self.mix2_tab.setTabEnabled(2, False)  # SPDIF
            self.mix2_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix3_tab.setTabEnabled(3, False)  # ADAT
            self.mix3_tab.setTabEnabled(2, False)  # SPDIF
            self.mix3_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix4_tab.setTabEnabled(3, False)  # ADAT
            self.mix4_tab.setTabEnabled(2, False)  # SPDIF
            self.mix4_tab.setTabEnabled(1, False)  # AES/EBU
        if (self.sample_rate > 48000):
            log.debug("Disabling controls not present above 48 kHz")
            self.mix1adat5.setEnabled(False)
            self.mix1adat6.setEnabled(False)
            self.mix1adat7.setEnabled(False)
            self.mix1adat8.setEnabled(False)
            self.mix2adat5.setEnabled(False)
            self.mix2adat6.setEnabled(False)
            self.mix2adat7.setEnabled(False)
            self.mix2adat8.setEnabled(False)
            self.mix3adat5.setEnabled(False)
            self.mix3adat6.setEnabled(False)
            self.mix3adat7.setEnabled(False)
            self.mix3adat8.setEnabled(False)
            self.mix4adat5.setEnabled(False)
            self.mix4adat6.setEnabled(False)
            self.mix4adat7.setEnabled(False)
            self.mix4adat8.setEnabled(False)

        # Ensure the correct input controls are active for a given interface.
        # Only the Ultralite has phase inversion switches.
        if (not (self.model == MOTU_MODEL_ULTRALITE)):
            self.disable_hide(self.ana1_invert)
            self.disable_hide(self.ana2_invert)
            self.disable_hide(self.ana3_invert)
            self.disable_hide(self.ana4_invert)
            self.disable_hide(self.ana5_invert)
            self.disable_hide(self.ana6_invert)
            self.disable_hide(self.ana7_invert)
            self.disable_hide(self.ana8_invert)
            self.disable_hide(self.spdif1_invert)
            self.disable_hide(self.spdif2_invert)
        # The Traveler has pad switches for analog 1-4 only; other interfaces
        # don't have pad switches at all.
        if (not (self.model == MOTU_MODEL_TRAVELER)):
            self.disable_hide(self.ana1_pad)
            self.disable_hide(self.ana2_pad)
            self.disable_hide(self.ana3_pad)
            self.disable_hide(self.ana4_pad)
        self.disable_hide(self.ana5_pad)
        self.disable_hide(self.ana6_pad)
        self.disable_hide(self.ana7_pad)
        self.disable_hide(self.ana8_pad)
        # The Traveler has level and boost switches for analog 5-8.  The
        # 8pre, Ultralite and the 896HD don't implement them.  All other
        # interfaces have them over analog 1-8.
        if (self.model == MOTU_MODEL_TRAVELER
                or self.model == MOTU_MODEL_ULTRALITE
                or self.model == MOTU_MODEL_896HD
                or self.model == MOTU_MODEL_8PRE):
            self.disable_hide(self.ana1_level)
            self.disable_hide(self.ana2_level)
            self.disable_hide(self.ana3_level)
            self.disable_hide(self.ana4_level)
            self.disable_hide(self.ana1_boost)
            self.disable_hide(self.ana2_boost)
            self.disable_hide(self.ana3_boost)
            self.disable_hide(self.ana4_boost)
        if (self.model == MOTU_MODEL_ULTRALITE
                or self.model == MOTU_MODEL_896HD
                or self.model == MOTU_MODEL_8PRE):
            self.disable_hide(self.ana5_level)
            self.disable_hide(self.ana6_level)
            self.disable_hide(self.ana7_level)
            self.disable_hide(self.ana8_level)
            self.disable_hide(self.ana5_boost)
            self.disable_hide(self.ana6_boost)
            self.disable_hide(self.ana7_boost)
            self.disable_hide(self.ana8_boost)
        # The Traveler has trimgain for analog 1-4.  The Ultralite has trimgain for
        # analog 1-8 and SPDIF 1-2.  All other interfaces don't have trimgain.
        if (not (self.model == MOTU_MODEL_TRAVELER
                 or self.model == MOTU_MODEL_ULTRALITE)):
            self.disable_hide(self.ana1_trimgain)
            self.disable_hide(self.ana1_trimgain_label)
            self.disable_hide(self.ana2_trimgain)
            self.disable_hide(self.ana2_trimgain_label)
            self.disable_hide(self.ana3_trimgain)
            self.disable_hide(self.ana3_trimgain_label)
            self.disable_hide(self.ana4_trimgain)
            self.disable_hide(self.ana4_trimgain_label)
        if (not (self.model == MOTU_MODEL_ULTRALITE)):
            self.disable_hide(self.ana5_trimgain)
            self.disable_hide(self.ana5_trimgain_label)
            self.disable_hide(self.ana6_trimgain)
            self.disable_hide(self.ana6_trimgain_label)
            self.disable_hide(self.ana7_trimgain)
            self.disable_hide(self.ana7_trimgain_label)
            self.disable_hide(self.ana8_trimgain)
            self.disable_hide(self.ana8_trimgain_label)
            self.disable_hide(self.spdif1_trimgain)
            self.disable_hide(self.spdif1_trimgain_label)
            self.disable_hide(self.spdif1ctrl)
            self.disable_hide(self.spdif2_trimgain)
            self.disable_hide(self.spdif2_trimgain_label)
            self.disable_hide(self.spdif2ctrl)

        # Now fetch the current values into the respective controls.  Don't
        # bother fetching controls which are disabled.
        for ctrl, info in self.ChannelFaders.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            vol = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" %
                      (info[0], info[1], info[2], vol))
            ctrl.setValue(vol)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateChannelFader)

        for ctrl, info in self.Faders.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            vol = self.hw.getDiscrete(info[0])
            log.debug("%s mix fader is %d" % (info[0], vol))
            ctrl.setValue(vol)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateFader)

        for ctrl, info in self.ChannelControls.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            pan = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" %
                      (info[0], info[1], info[2], pan))
            ctrl.setValue(pan)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateChannelControl)

        for ctrl, info in self.Controls.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            pan = self.hw.getDiscrete(info[0])
            log.debug("%s control is %d" % (info[0], pan))
            ctrl.setValue(pan)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateControl)

        for ctrl, info in self.ChannelBinarySwitches.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            val = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" %
                      (info[0], info[1], info[2], val))
            if val:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)
            QObject.connect(ctrl, SIGNAL('toggled(bool)'),
                            self.updateChannelBinarySwitch)

        for ctrl, info in self.BinarySwitches.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            val = self.hw.getDiscrete(info[0])
            log.debug("%s switch is %d" % (info[0], val))
            if val:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)
            QObject.connect(ctrl, SIGNAL('toggled(bool)'),
                            self.updateBinarySwitch)

        for ctrl, info in self.Selectors.iteritems():
            if (not (ctrl.isEnabled())):
                continue
            dest = self.hw.getDiscrete(info[0])
            log.debug("%s selector is %d" % (info[0], dest))
            ctrl.setCurrentIndex(dest)
            QObject.connect(ctrl, SIGNAL('activated(int)'),
                            self.updateSelector)
Example #47
0
    def initValues(self):
        # Is the device streaming?
        self.is_streaming = self.hw.getDiscrete('/Mixer/Info/IsStreaming')
        log.debug("device streaming flag: %d" % (self.is_streaming))

        # Retrieve other device settings as needed
        self.model = self.hw.getDiscrete('/Mixer/Info/Model')
        log.debug("device model identifier: %d" % (self.model))
        self.sample_rate = self.hw.getDiscrete('/Mixer/Info/SampleRate')
        log.debug("device sample rate: %d" % (self.sample_rate))
        self.has_mic_inputs = self.hw.getDiscrete('/Mixer/Info/HasMicInputs')
        log.debug("device has mic inputs: %d" % (self.has_mic_inputs))
        self.has_aesebu_inputs = self.hw.getDiscrete('/Mixer/Info/HasAESEBUInputs')
        log.debug("device has AES/EBU inputs: %d" % (self.has_aesebu_inputs))
        self.has_spdif_inputs = self.hw.getDiscrete('/Mixer/Info/HasSPDIFInputs')
        log.debug("device has SPDIF inputs: %d" % (self.has_spdif_inputs))
        self.has_optical_spdif = self.hw.getDiscrete('/Mixer/Info/HasOpticalSPDIF')
        log.debug("device has optical SPDIF: %d" % (self.has_optical_spdif))

        # Customise the UI based on device options retrieved
        if (self.has_mic_inputs):
            # Mic input controls displace AES/EBU since no current device
            # has both.
            self.mix1_tab.setTabText(1, "Mic inputs");
            self.mix2_tab.setTabText(1, "Mic inputs");
            self.mix3_tab.setTabText(1, "Mic inputs");
            self.mix4_tab.setTabText(1, "Mic inputs");
            # FIXME: when implmented, will mic channels just reuse the AES/EBU
            # dbus path?  If not we'll have to reset the respective values in
            # the control arrays (self.ChannelFaders etc).
        else:
            if (not(self.has_aesebu_inputs)):
                self.mix1_tab.setTabEnabled(1, False)
                self.mix2_tab.setTabEnabled(1, False)
                self.mix3_tab.setTabEnabled(1, False)
                self.mix4_tab.setTabEnabled(1, False)
        if (not(self.has_spdif_inputs)):
            self.mix1_tab.setTabEnabled(2, False);
            self.mix2_tab.setTabEnabled(2, False);
            self.mix3_tab.setTabEnabled(2, False);
            self.mix4_tab.setTabEnabled(2, False);

        # Devices without AES/EBU inputs/outputs (normally ID 6 in the
        # destination lists) have dedicated "MainOut" outputs instead.  The
        # 896HD is an exception: it uses ID 6 for MainOut and ID 7
        # (nominally SPDIF) for AES/EBU.
        if (not(self.has_aesebu_inputs) or self.model==MOTU_MODEL_896HD):
            self.mix1_dest.setItemText(6, "MainOut")
            self.mix2_dest.setItemText(6, "MainOut")
            self.mix3_dest.setItemText(6, "MainOut")
            self.mix4_dest.setItemText(6, "MainOut")
            self.phones_src.setItemText(6, "MainOut")
        # Change the SPDIF destination to AES/EBU for the 896HD.
        if (self.model == MOTU_MODEL_896HD):
            self.mix1_dest.setItemText(7, "AES/EBU")
            self.mix2_dest.setItemText(7, "AES/EBU")
            self.mix3_dest.setItemText(7, "AES/EBU")
            self.mix4_dest.setItemText(7, "AES/EBU")
            self.phones_src.setItemText(7, "AES/EBU")

        # The Ultralite doesn't have ADAT channels
        if (self.model == MOTU_MODEL_ULTRALITE):
            self.mix1_tab.setTabEnabled(3, False)  # ADAT page
            self.mix2_tab.setTabEnabled(3, False)  # ADAT page
            self.mix3_tab.setTabEnabled(3, False)  # ADAT page
            self.mix4_tab.setTabEnabled(3, False)  # ADAT page

        # Some devices don't have the option of selecting an optical SPDIF
        # mode.
        if (not(self.has_optical_spdif)):
            self.optical_in_mode.removeItem(2)
            self.optical_out_mode.removeItem(2)

        # Only the 896HD has meter controls
        if (self.model != MOTU_MODEL_896HD):
            self.disable_hide(self.meter_src)
            self.disable_hide(self.aesebu_meter)
            self.disable_hide(self.peakhold_time)
            self.disable_hide(self.cliphold_time)

        # Some controls must be disabled if the device is streaming
        if (self.is_streaming):
            log.debug("Disabling controls which require inactive streaming")
            self.optical_in_mode.setEnabled(False)
            self.optical_out_mode.setEnabled(False)

        # Some channels aren't available at higher sampling rates
        if (self.sample_rate > 96000):
            log.debug("Disabling controls not present above 96 kHz")
            self.mix1_tab.setTabEnabled(3, False)  # ADAT
            self.mix1_tab.setTabEnabled(2, False)  # SPDIF
            self.mix1_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix2_tab.setTabEnabled(3, False)  # ADAT
            self.mix2_tab.setTabEnabled(2, False)  # SPDIF
            self.mix2_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix3_tab.setTabEnabled(3, False)  # ADAT
            self.mix3_tab.setTabEnabled(2, False)  # SPDIF
            self.mix3_tab.setTabEnabled(1, False)  # AES/EBU
            self.mix4_tab.setTabEnabled(3, False)  # ADAT
            self.mix4_tab.setTabEnabled(2, False)  # SPDIF
            self.mix4_tab.setTabEnabled(1, False)  # AES/EBU
        if (self.sample_rate > 48000):
            log.debug("Disabling controls not present above 48 kHz")
            self.mix1_adat5.setEnabled(False)
            self.mix1_adat6.setEnabled(False)
            self.mix1_adat7.setEnabled(False)
            self.mix1_adat8.setEnabled(False)
            self.mix2_adat5.setEnabled(False)
            self.mix2_adat6.setEnabled(False)
            self.mix2_adat7.setEnabled(False)
            self.mix2_adat8.setEnabled(False)
            self.mix3_adat5.setEnabled(False)
            self.mix3_adat6.setEnabled(False)
            self.mix3_adat7.setEnabled(False)
            self.mix3_adat8.setEnabled(False)
            self.mix4_adat5.setEnabled(False)
            self.mix4_adat6.setEnabled(False)
            self.mix4_adat7.setEnabled(False)
            self.mix4_adat8.setEnabled(False)

        # Ensure the correct input controls are active for a given interface
        if (self.model == MOTU_MODEL_TRAVELER):
            self.disable_hide(self.ana1_level)
            self.disable_hide(self.ana2_level)
            self.disable_hide(self.ana3_level)
            self.disable_hide(self.ana4_level)
            self.disable_hide(self.ana1_boost)
            self.disable_hide(self.ana2_boost)
            self.disable_hide(self.ana3_boost)
            self.disable_hide(self.ana4_boost)
            self.disable_hide(self.ana5_trimgain)
            self.disable_hide(self.ana5_trimgain_label)
            self.disable_hide(self.ana6_trimgain)
            self.disable_hide(self.ana6_trimgain_label)
            self.disable_hide(self.ana7_trimgain)
            self.disable_hide(self.ana7_trimgain_label)
            self.disable_hide(self.ana8_trimgain)
            self.disable_hide(self.ana8_trimgain_label)
            self.disable_hide(self.ana5_pad)
            self.disable_hide(self.ana6_pad)
            self.disable_hide(self.ana7_pad)
            self.disable_hide(self.ana8_pad)
        else:
            self.disable_hide(self.ana1_trimgain)
            self.disable_hide(self.ana1_trimgain_label)
            self.disable_hide(self.ana2_trimgain)
            self.disable_hide(self.ana2_trimgain_label)
            self.disable_hide(self.ana3_trimgain)
            self.disable_hide(self.ana3_trimgain_label)
            self.disable_hide(self.ana4_trimgain)
            self.disable_hide(self.ana4_trimgain_label)
            self.disable_hide(self.ana1_pad)
            self.disable_hide(self.ana2_pad)
            self.disable_hide(self.ana3_pad)
            self.disable_hide(self.ana4_pad)
            self.disable_hide(self.ana5_trimgain)
            self.disable_hide(self.ana5_trimgain_label)
            self.disable_hide(self.ana6_trimgain)
            self.disable_hide(self.ana6_trimgain_label)
            self.disable_hide(self.ana7_trimgain)
            self.disable_hide(self.ana7_trimgain_label)
            self.disable_hide(self.ana8_trimgain)
            self.disable_hide(self.ana8_trimgain_label)
            self.disable_hide(self.ana5_pad)
            self.disable_hide(self.ana6_pad)
            self.disable_hide(self.ana7_pad)
            self.disable_hide(self.ana8_pad)

        # Now fetch the current values into the respective controls.  Don't
        # bother fetching controls which are disabled.
        for ctrl, info in self.ChannelFaders.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            vol = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" % (info[0], info[1], info[2], vol))
            ctrl.setValue(vol)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateChannelFader)

        for ctrl, info in self.Faders.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            vol = self.hw.getDiscrete(info[0])
            log.debug("%s mix fader is %d" % (info[0] , vol))
            ctrl.setValue(vol)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateFader)

        for ctrl, info in self.ChannelControls.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            pan = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" % (info[0], info[1], info[2], pan))
            ctrl.setValue(pan)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateChannelControl)

        for ctrl, info in self.Controls.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            pan = self.hw.getDiscrete(info[0])
            log.debug("%s control is %d" % (info[0] , pan))
            ctrl.setValue(pan)
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'), self.updateControl)

        # Disable the channel pair controls since they aren't yet implemented
        for ctrl, info in self.PairSwitches.iteritems():
            log.debug("%s control is not implemented yet: disabling" % (info[0]))
            ctrl.setEnabled(False)

        for ctrl, info in self.ChannelBinarySwitches.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            val = self.hw.getMatrixMixerValue(info[0], info[1], info[2])
            log.debug("%s for mix %d channel %d is %d" % (info[0] , info[1], info[2], val))
            if val:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)
            QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updateChannelBinarySwitch)

        for ctrl, info in self.BinarySwitches.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            val = self.hw.getDiscrete(info[0])
            log.debug("%s switch is %d" % (info[0] , val))
            if val:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)
            QObject.connect(ctrl, SIGNAL('toggled(bool)'), self.updateBinarySwitch)

        for ctrl, info in self.MixDests.iteritems():
            if (not(ctrl.isEnabled())):
                continue
            dest = self.hw.getDiscrete(info[0])
            log.debug("%s mix destination is %d" % (info[0] , dest))
            ctrl.setCurrentIndex(dest)
            QObject.connect(ctrl, SIGNAL('activated(int)'), self.updateMixDest)

        for name, ctrl in self.SelectorControls.iteritems():
            state = self.hw.getDiscrete(ctrl[0])
            log.debug("%s state is %d" % (name , state))
            ctrl[1].setCurrentIndex(state)
Example #48
0
 def run(self):
     QObject.connect(self, SIGNAL('do_runQuickAnalysis()'),
                     self.handle_runQuickAnalysis, Qt.DirectConnection)
     self.exec_()
Example #49
0
    def initGui(self):
        """Create the menu entries and toolbar icons inside the QGIS GUI."""
        self.menu = QMenu()
        self.menu.setTitle(u"QVertex")

        self.qvertex_createProject = QAction(u"Создать проект", self.iface.mainWindow())
        self.qvertex_createProject.setEnabled(True)
        # self.qvertex_createProject.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        self.menu.addAction(self.qvertex_createProject)

        # self.qvertex_showSettings = QAction(u"Настройка МСК", self.iface.mainWindow())
        # self.qvertex_showSettings.setEnabled(True)
        # # self.qvertex_showSettings.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        # self.menu.addAction(self.qvertex_showSettings)


        self.pointMenu = QMenu()
        self.pointMenu.setTitle(u"Точки")

        self.qvertex_createVertex = QAction(u"Создать примыкающие вершины", self.iface.mainWindow())
        self.qvertex_createVertex.setEnabled(True)
        # self.qvertex_createVertex.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))

        self.qvertex_createPoint = QAction(u"Создать характерные точки", self.iface.mainWindow())
        self.qvertex_createPoint.setEnabled(True)
        #self.qvertex_createPoint.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))

        #self.qvertex_createNewPoint.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        self.pointMenu.addActions([self.qvertex_createVertex, self.qvertex_createPoint])
        self.menu.addMenu(self.pointMenu)

        self.qvertex_createBoundPart = QAction(u"Создать части границ", self.iface.mainWindow())
        self.qvertex_createBoundPart.setEnabled(True)
        # self.qvertex_createProject.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        self.menu.addAction(self.qvertex_createBoundPart)


        self.reportMenu = QMenu()
        self.reportMenu.setTitle(u"Отчёты")

        self.qvertex_createCtalog = QAction(u"HTML-ведомость координат", self.iface.mainWindow())
        self.qvertex_createCtalog.setEnabled(True)

        self.qvertex_createMapPlan = QAction(u"HTML-ведомость карта(план)", self.iface.mainWindow())
        self.qvertex_createMapPlan.setEnabled(True)

        self.qvertex_createGeodata = QAction(u"SVG-ведомость и описание границ", self.iface.mainWindow())
        self.qvertex_createGeodata.setEnabled(True)
        # self.qvertex_createGeodata.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        self.reportMenu.addActions([self.qvertex_createCtalog, self.qvertex_createMapPlan, self.qvertex_createGeodata])
        self.menu.addMenu(self.reportMenu)

        self.qvertex_exportTechno = QAction(u"Экспорт в Технокад", self.iface.mainWindow())
        self.qvertex_exportTechno.setEnabled(True)
        # self.qvertex_exportTechno.setIcon(QIcon(":/plugins/QVertex/icons/importkk.png"))
        self.menu.addAction(self.qvertex_exportTechno)

        #self.menu.addActions([self.qvertex_createCtalog, self.qvertex_createGeodata])


        menu_bar = self.iface.mainWindow().menuBar()
        actions = menu_bar.actions()
        lastAction = actions[len(actions) - 1]
        menu_bar.insertMenu(lastAction, self.menu)
        #icon_path = ':/plugins/QVertex/icon.png'
        # self.add_action(
        #     icon_path,
        #     text=self.tr(u'Землеустройство'),
        #     callback=self.run,
        #     parent=self.iface.mainWindow())

        QObject.connect(self.qvertex_createProject, SIGNAL("triggered()"), self.doCreateProject)
        QObject.connect(self.qvertex_createVertex, SIGNAL("triggered()"), self.doCreatePublicVertexes)
        QObject.connect(self.qvertex_createPoint, SIGNAL("triggered()"), self.doCreatepoint)
        QObject.connect(self.qvertex_createCtalog, SIGNAL("triggered()"), self.doCreateCoordcatalog)
        QObject.connect(self.qvertex_createMapPlan, SIGNAL("triggered()"), self.doCatalogMapPlan)
        QObject.connect(self.qvertex_createGeodata, SIGNAL("triggered()"), self.doCreateGeodata)
        QObject.connect(self.qvertex_createBoundPart, SIGNAL("triggered()"), self.createBoundPart)
        QObject.connect(self.qvertex_exportTechno, SIGNAL("triggered()"), self.exportTechno)
Example #50
0
 def on_actionSettings_triggered(self, tabIndex=0):
     settings_dialog = Settings(self, tabIndex)
     QObject.connect(settings_dialog, SIGNAL('accepted()'),
                     self.updateTextEditor)
     settings_dialog.show()
 def __draw__(self):
     global _progress, f
     f = open(filename, "a")
     f.write("Rendering function...\n")
     f.close()
     for i in range(len(Paths["Images"])):
         Visum.Graphic.Backgrounds.ItemByKey(
             Paths["Images"][i]).Draw = False
     if not os.path.exists(self._image_path) or Paths["Images"].count(
             self._image_path) == 0:
         f = open(filename, "a")
         f.write("If not os.path.exists or image not in Paths...\n")
         f.close()
         QObject.connect(self._webpage, SIGNAL("loadStarted()"),
                         self.__loading__)
         QObject.connect(self._webpage, SIGNAL("loadProgress(int)"),
                         self.__progress__)
         QObject.connect(self._webpage, SIGNAL("loadFinished(bool)"),
                         self.__loaded__)
         self._webpage.mainFrame().load(QUrl(self._url))
         self._webpage.mainFrame().evaluateJavaScript(
             "x0 = %f; y0 = %f; x1 = %f; y1 = %f;" %
             (self._param[0], self._param[1], self._param[2],
              self._param[3]))
         self._webpage.mainFrame().evaluateJavaScript(
             "width = %d; height = %d;" %
             (self._multiply * self._dimension[0],
              self._multiply * self._dimension[1]))
         self._webpage.mainFrame().evaluateJavaScript("value = %d;" %
                                                      (self._layer))
         while self._loading:
             QCoreApplication.processEvents()
         QObject.disconnect(self._webpage, SIGNAL("loadStarted()"),
                            self.__loading__)
         QObject.disconnect(self._webpage, SIGNAL("loadProgress(int)"),
                            self.__progress__)
         QObject.disconnect(self._webpage, SIGNAL("loadFinished(bool)"),
                            self.__loaded__)
         loop = QEventLoop()
         timer = QTimer()
         timer.setSingleShot(True)
         timer.timeout.connect(loop.quit)
         timerProgress = QTimer()
         QObject.connect(timerProgress, SIGNAL("timeout()"),
                         self.__on_loop__)
         if self._layer == 10: timer.start(0)
         elif self._layer >= 4 and self._layer <= 9:
             timer.start(800 * self._multiply * 4.0)
             timerProgress.start(800 * self._multiply * 4.0 / 16.0)
         else:
             timer.start(2400 * self._multiply * 4.0)
             timerProgress.start(2400 * self._multiply * 4.0 / 49.0)
         loop.exec_()
         QObject.disconnect(timerProgress, SIGNAL("timeout()"),
                            self.__on_loop__)
         background_params = self._webpage.mainFrame().evaluateJavaScript(
             "getRealBounds();").toString()
         background_params = background_params[1:-1]
         background_params = [
             float(s) for s in background_params.split(", ")
         ]
         self._webpage.setViewportSize(
             self._webpage.mainFrame().contentsSize())
         f = open(filename, "a")
         f.write("Setting up an image file...\n")
         f.close()
         image = QImage(self._webpage.viewportSize(), QImage.Format_RGB32)
         f = open(filename, "a")
         f.write("Starting a painter...\n")
         f.close()
         painter = QPainter(image)
         f = open(filename, "a")
         f.write("Rendering from frame...\n")
         f.write(str(self._webpage.viewportSize()) + "\n")
         f.close()
         self._webpage.mainFrame().render(painter)
         painter.end()
         image.save(self._image_path)
         f = open(filename, "a")
         f.write("Image saved.\n")
         f.close()
         Visum.Graphic.AddBackgroundOnPos(self._image_path,
                                          background_params[0],
                                          background_params[1],
                                          background_params[2],
                                          background_params[3])
         Paths["Images"].append(self._image_path)
         f = open(filename, "a")
         f.write("End of if not os.path.exists or image not in Paths.\n")
         f.close()
     else:
         f = open(filename, "a")
         f.write("If os.path.exists and image in Paths...\n")
         f.close()
         index = Paths["Images"].index(self._image_path)
         Visum.Graphic.Backgrounds.ItemByKey(
             Paths["Images"][index]).Draw = True
         f = open(filename, "a")
         f.write("End of if os.path.exists and image in Paths...\n")
         f.close()
     _progress = 100
     del self._webpage
     f = open(filename, "a")
     f.write("Rendering completed.\n")
     f.close()
Example #52
0
 def setupUi(self, port):
     self.setObjectName("MainWindow")
     self.resize(600, 600)
     self.centralwidget = QWidget(self)
     p = self.centralwidget.palette()
     self.centralwidget.setAutoFillBackground(True)
     p.setColor(self.centralwidget.backgroundRole(), QColor(126, 135, 152))
     self.centralwidget.setPalette(p)
     self.centralwidget.setObjectName("centralwidget")
     self.gridLayout = QGridLayout(self.centralwidget)
     self.gridLayout.setObjectName("gridLayout")
     self.setCentralWidget(self.centralwidget)
     self.menubar = QMenuBar(self)
     self.menubar.setGeometry(QRect(0, 0, 808, 25))
     self.menubar.setObjectName("menubar")
     self.menuFile = QMenu(self.menubar)
     self.menuFile.setObjectName("menuFile")
     self.setMenuBar(self.menubar)
     self.statusbar = QStatusBar(self)
     self.statusbar.setObjectName("statusbar")
     self.setStatusBar(self.statusbar)
     self.actionQuit = QAction(self)
     self.actionQuit.setObjectName("actionQuit")
     self.menuFile.addSeparator()
     self.menuFile.addAction(self.actionQuit)
     self.menubar.addAction(self.menuFile.menuAction())
     self.actionReset = QAction(self)
     self.actionReset.setObjectName("reset")
     self.menuFile.addSeparator()
     self.menuFile.addAction(self.actionReset)
     self.menubar.addAction(self.menuFile.menuAction())
     # add other GUI objects
     self.graph_widget = GraphWidget(self.statusbar)
     self.gridLayout.addWidget(self.graph_widget, 1, 11, 10, 10)
     pixmap = QPixmap(':/images/cta-logo-mini.png')
     lbl = QLabel()
     lbl.setPixmap(pixmap)
     self.gridLayout.addWidget(lbl, 0, 0)
     p = self.graph_widget.palette()
     self.graph_widget.setAutoFillBackground(True)
     p.setColor(self.graph_widget.backgroundRole(),
                QColor(255, 255, 255))  # QColor(226, 235, 252))
     self.graph_widget.setPalette(p)
     self.quitButton = QPushButton()  # self.centralwidget)
     self.quitButton.setObjectName("quitButton")
     self.quitButton.setText(
         QApplication.translate("MainWindow", "Quit", None,
                                QApplication.UnicodeUTF8))
     self.gridLayout.addWidget(self.quitButton, 12, 0, 1, 1)
     self.info_label = InfoLabel(0, 4)
     self.info_label.setAutoFillBackground(True)
     self.gridLayout.addWidget(self.info_label, 1, 0, 1, 5)
     # self.info_label.setAlignment(PyQt4.Qt.AlignCenter);
     palette = QPalette()
     palette.setColor(self.info_label.backgroundRole(), Qt.lightGray)
     self.info_label.setPalette(palette)
     QObject.connect(self.quitButton, SIGNAL("clicked()"), self.stop)
     QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.stop)
     QMetaObject.connectSlotsByName(self)
     self.retranslateUi()
     QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.close)
     QMetaObject.connectSlotsByName(self)
     # Create GuiConnexion for ZMQ comminucation with pipeline
     self.guiconnection = GuiConnexion(gui_port=port,
                                       statusBar=self.statusbar)
     self.guiconnection.message.connect(self.graph_widget.pipechange)
     self.guiconnection.message.connect(self.info_label.pipechange)
     self.guiconnection.reset_message.connect(self.graph_widget.reset)
     self.guiconnection.reset_message.connect(self.info_label.reset)
     self.guiconnection.mode_message.connect(self.info_label.mode_receive)
     QObject.connect(self.actionReset, SIGNAL("triggered()"),
                     self.guiconnection.reset)
     QMetaObject.connectSlotsByName(self)
     # start the process
     self.guiconnection.start()
Example #53
0
 def create_document(self):
     self.document = Document(self.logger, self.opts)
     QObject.connect(self.document, SIGNAL('chapter_rendered(int)'),
                     self.chapter_rendered)
     QObject.connect(self.document, SIGNAL('page_changed(PyQt_PyObject)'),
                     self.page_changed)
 def __setup_gui__(self, Dialog):
     global f
     f = open(filename, "a")
     f.write("Setup of gui.\n")
     f.close()
     Dialog.setObjectName("Dialog")
     Dialog.resize(270, 145)
     self.setWindowTitle("Map Layer")
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width() - size.width()) / 2,
               (screen.height() - size.height()) / 2)
     self.Render = QPushButton("Render", Dialog)
     self.Render.setGeometry(QRect(85, 90, 100, 25))
     self.Render.setObjectName("Render")
     self.comboBox = QComboBox(Dialog)
     self.comboBox.setGeometry(QRect(100, 34, 115, 18))
     self.comboBox.setEditable(False)
     self.comboBox.setMaxVisibleItems(11)
     self.comboBox.setInsertPolicy(QComboBox.InsertAtBottom)
     self.comboBox.setObjectName("comboBox")
     self.comboBox.addItems([
         "Google Roadmap", "Google Terrain", "Google Satellite",
         "Google Hybrid", "Yahoo Roadmap", "Yahoo Satellite",
         "Yahoo Hybrid", "Bing Roadmap", "Bing Satellite", "Bing Hybrid",
         "Open Street Maps"
     ])
     self.comboBox.setCurrentIndex(10)
     self.label1 = QLabel("Source:", Dialog)
     self.label1.setGeometry(QRect(55, 35, 35, 16))
     self.label1.setObjectName("label1")
     self.slider = QSlider(Dialog)
     self.slider.setOrientation(Qt.Horizontal)
     self.slider.setMinimum(1)
     self.slider.setMaximum(12)
     self.slider.setValue(4)
     self.slider.setGeometry(QRect(110, 61, 114, 16))
     self.label2 = QLabel("Quality: " + str(self.slider.value()), Dialog)
     self.label2.setGeometry(QRect(47, 61, 54, 16))
     self.label2.setObjectName("label2")
     self.doubleSpinBox = QDoubleSpinBox(Dialog)
     self.doubleSpinBox.setGeometry(QRect(160, 5, 40, 20))
     self.doubleSpinBox.setDecimals(0)
     self.doubleSpinBox.setObjectName("doubleSpinBox")
     self.doubleSpinBox.setMinimum(10.0)
     self.doubleSpinBox.setValue(20.0)
     self.doubleSpinBox.setEnabled(False)
     self.checkBox = QCheckBox("Auto refresh", Dialog)
     self.checkBox.setGeometry(QRect(50, 6, 100, 20))
     self.checkBox.setLayoutDirection(Qt.RightToLeft)
     self.checkBox.setObjectName("checkBox")
     self.progressBar = QProgressBar(Dialog)
     self.progressBar.setGeometry(QRect(5, 130, 260, 10))
     self.progressBar.setProperty("value", 0)
     self.progressBar.setTextVisible(False)
     self.progressBar.setObjectName("progressBar")
     self.progressBar.setVisible(False)
     QObject.connect(self.Render, SIGNAL("clicked()"), Dialog.__repaint__)
     QMetaObject.connectSlotsByName(Dialog)
     QObject.connect(self.slider, SIGNAL("valueChanged(int)"),
                     self.__update_slider_label__)
     QObject.connect(self.comboBox, SIGNAL("activated(int)"),
                     self.__combobox_changed__)
     self.timerRepaint = QTimer()
     QObject.connect(self.checkBox, SIGNAL("clicked()"),
                     self.__activate_timer__)
     QObject.connect(self.timerRepaint, SIGNAL("timeout()"),
                     self.__on_timer__)
     f = open(filename, "a")
     f.write("End of setup of gui.\n")
     f.close()
Example #55
0
    """
        Demo application showing PinMatrix widget in action
    """
    app = QApplication(sys.argv)

    matrix = PinMatrixWidget()

    def clicked():
        print("PinMatrix value is", matrix.get_value())
        print("Possible button combinations:", matrix.get_strength())
        sys.exit()

    ok = QPushButton("OK")
    if QT_VERSION_STR >= "5":
        ok.clicked.connect(clicked)
    elif QT_VERSION_STR >= "4":
        QObject.connect(ok, SIGNAL("clicked()"), clicked)
    else:
        raise RuntimeError("Unsupported Qt version")

    vbox = QVBoxLayout()
    vbox.addWidget(matrix)
    vbox.addWidget(ok)

    w = QWidget()
    w.setLayout(vbox)
    w.move(100, 100)
    w.show()

    app.exec_()
Example #56
0
    def __init__(self, logger, opts, parent=None):
        MainWindow.__init__(self, opts, parent)
        Ui_MainWindow.__init__(self)
        self.setupUi(self)
        self.setAttribute(Qt.WA_DeleteOnClose)
        self.setWindowTitle(__appname__ + _(' - LRF Viewer'))

        self.logger = logger
        self.opts = opts
        self.create_document()
        self.spin_box_action = self.spin_box = QSpinBox()
        self.tool_bar.addWidget(self.spin_box)
        self.tool_bar.addSeparator()
        self.slider_action = self.slider = QSlider(Qt.Horizontal)
        self.tool_bar.addWidget(self.slider)
        self.tool_bar.addSeparator()
        self.search = SearchBox2(self)
        self.search.initialize('lrf_viewer_search_history')
        self.search_action = self.tool_bar.addWidget(self.search)
        self.search.search.connect(self.find)

        self.action_next_page.setShortcuts(
            [QKeySequence.MoveToNextPage,
             QKeySequence(Qt.Key_Space)])
        self.action_previous_page.setShortcuts(
            [QKeySequence.MoveToPreviousPage,
             QKeySequence(Qt.Key_Backspace)])
        self.action_next_match.setShortcuts(QKeySequence.FindNext)
        self.addAction(self.action_next_match)
        QObject.connect(self.action_next_page, SIGNAL('triggered(bool)'),
                        self.next)
        QObject.connect(self.action_previous_page, SIGNAL('triggered(bool)'),
                        self.previous)
        QObject.connect(self.action_back, SIGNAL('triggered(bool)'), self.back)
        QObject.connect(self.action_forward, SIGNAL('triggered(bool)'),
                        self.forward)
        QObject.connect(self.action_next_match, SIGNAL('triggered(bool)'),
                        self.next_match)
        QObject.connect(self.action_open_ebook, SIGNAL('triggered(bool)'),
                        self.open_ebook)
        QObject.connect(self.action_configure, SIGNAL('triggered(bool)'),
                        self.configure)
        QObject.connect(self.spin_box, SIGNAL('valueChanged(int)'),
                        self.go_to_page)
        QObject.connect(self.slider, SIGNAL('valueChanged(int)'),
                        self.go_to_page)

        self.graphics_view.setRenderHint(QPainter.Antialiasing, True)
        self.graphics_view.setRenderHint(QPainter.TextAntialiasing, True)
        self.graphics_view.setRenderHint(QPainter.SmoothPixmapTransform, True)

        self.closed = False
Example #57
0
    def initValues(self):
        log.debug("Init values")

        for ctrl, info in self.MatrixVolumeControls.iteritems():
            vol = self.hw.getMatrixMixerValue(self.MatrixVolumeControls[ctrl][0],
                                                self.MatrixVolumeControls[ctrl][1],
                                                self.MatrixVolumeControls[ctrl][2])

            #vol = 0x01000000-vol
            log.debug("%s volume is %d" % (ctrl.objectName() , vol))
            ctrl.setValue(vol)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixVolume)

        for ctrl, info in self.MatrixButtonControls.iteritems():
            state = self.hw.getMatrixMixerValue(self.MatrixButtonControls[ctrl][0],
                                                self.MatrixButtonControls[ctrl][1],
                                                self.MatrixButtonControls[ctrl][2])

            log.debug("%s state is %d" % (ctrl.objectName() , state))
            if state:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('clicked(bool)'),self.updateMatrixButton)

        for ctrl, info in self.MatrixRotaryControls.iteritems():
            vol = self.hw.getMatrixMixerValue(self.MatrixRotaryControls[ctrl][0],
                                                self.MatrixRotaryControls[ctrl][1],
                                                self.MatrixRotaryControls[ctrl][2])

            log.debug("%s value is %d" % (ctrl.objectName(), vol))
            ctrl.setValue(vol)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateMatrixRotary)

        for ctrl, info in self.VolumeControls.iteritems():
            vol = self.hw.getContignuous(self.VolumeControls[ctrl][0])

            #vol = 0x01000000-vol
            log.debug("%s volume is %d" % (ctrl.objectName() , vol))
            ctrl.setValue(vol)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('valueChanged(int)'),self.updateVolume)

        for ctrl, info in self.SelectorControls.iteritems():
            state = self.hw.getDiscrete(self.SelectorControls[ctrl][0])
            log.debug("%s state is %d" % (ctrl.objectName() , state))
            if state:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('clicked(bool)'),self.updateSelector)

        for ctrl, info in self.TriggerControls.iteritems():
            # connect the UI element
            QObject.connect(ctrl,SIGNAL('clicked()'),self.updateTrigger)

        for ctrl, info in self.SPDIFmodeControls.iteritems():
            state = self.hw.getDiscrete(self.SPDIFmodeControls[ctrl][0])
            log.debug("%s state is %d" % (ctrl.objectName() , state))
            if state == self.SPDIFmodeControls[ctrl][1]:
                ctrl.setChecked(True)
            else:
                ctrl.setChecked(False)

            # connect the UI element
            QObject.connect(ctrl,SIGNAL('toggled(bool)'),self.updateSPDIFmodeControl)
Example #58
0
  def valorCombo(self, combo=None):	
	def valorC(item):
		self.valores[unicode(combo.objectName())]=unicode(item)	
	self.valores[unicode(combo.objectName())]=""
	valorC(unicode(combo.currentText()))
	QObject.connect(combo, SIGNAL("activated(const QString&)"), valorC)    
Example #59
0
    def __init__(self, menuFile, toolbar, ide):
        QObject.__init__(self)

        newAction = menuFile.addAction(
            QIcon(resources.IMAGES['new']),
            self.tr("&New File (%1)").arg(
                resources.get_shortcut("New-file").toString(
                    QKeySequence.NativeText)))
        newProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['newProj']),
            self.tr("New Pro&ject (%1)").arg(
                resources.get_shortcut("New-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        saveAction = menuFile.addAction(
            QIcon(resources.IMAGES['save']),
            self.tr("&Save (%1)").arg(
                resources.get_shortcut("Save-file").toString(
                    QKeySequence.NativeText)))
        saveAsAction = menuFile.addAction(QIcon(resources.IMAGES['saveAs']),
                                          self.tr("Save &As"))
        saveAllAction = menuFile.addAction(QIcon(resources.IMAGES['saveAll']),
                                           self.tr("Save All"))
        saveProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['saveAll']),
            self.tr("Save Pro&ject  (%1)").arg(
                resources.get_shortcut("Save-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        reloadFileAction = menuFile.addAction(
            QIcon(resources.IMAGES['reload-file']),
            self.tr("Reload File (%1)").arg(
                resources.get_shortcut("Reload-file").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        openAction = menuFile.addAction(
            QIcon(resources.IMAGES['open']),
            self.tr("&Open (%1)").arg(
                resources.get_shortcut("Open-file").toString(
                    QKeySequence.NativeText)))
        openProjectAction = menuFile.addAction(
            QIcon(resources.IMAGES['openProj']),
            self.tr("Open &Project (%1)").arg(
                resources.get_shortcut("Open-project").toString(
                    QKeySequence.NativeText)))
        menuFile.addSeparator()
        activateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['activate-profile']),
            self.tr("Activate Profile"))
        deactivateProfileAction = menuFile.addAction(
            QIcon(resources.IMAGES['deactivate-profile']),
            self.tr("Deactivate Profile"))
        menuFile.addSeparator()
        printFile = menuFile.addAction(
            QIcon(resources.IMAGES['print']),
            self.tr("Pr&int File (%1)").arg(
                resources.get_shortcut("Print-file").toString(
                    QKeySequence.NativeText)))
        closeAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Close Tab (%1)").arg(
                resources.get_shortcut("Close-tab").toString(
                    QKeySequence.NativeText)))
        closeProjectsAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Close All Projects"))
        menuFile.addSeparator()
        exitAction = menuFile.addAction(
            ide.style().standardIcon(QStyle.SP_DialogCloseButton),
            self.tr("&Exit"))

        self.toolbar_items = {
            'new-file': newAction,
            'new-project': newProjectAction,
            'save-file': saveAction,
            'save-as': saveAsAction,
            'save-all': saveAllAction,
            'save-project': saveProjectAction,
            'reload-file': reloadFileAction,
            'open-file': openAction,
            'open-project': openProjectAction,
            'activate-profile': activateProfileAction,
            'deactivate-profile': deactivateProfileAction,
            'print-file': printFile,
            'close-file': closeAction,
            'close-projects': closeProjectsAction
        }

        self.connect(newAction, SIGNAL("triggered()"),
                     ide.mainContainer.add_editor)
        self.connect(newProjectAction, SIGNAL("triggered()"),
                     ide.explorer.create_new_project)
        self.connect(openAction, SIGNAL("triggered()"),
                     ide.mainContainer.open_file)
        self.connect(saveAction, SIGNAL("triggered()"),
                     ide.mainContainer.save_file)
        self.connect(saveAsAction, SIGNAL("triggered()"),
                     ide.mainContainer.save_file_as)
        self.connect(saveAllAction, SIGNAL("triggered()"),
                     ide.actions.save_all)
        self.connect(saveProjectAction, SIGNAL("triggered()"),
                     ide.actions.save_project)
        self.connect(openProjectAction, SIGNAL("triggered()"),
                     ide.explorer.open_project_folder)
        self.connect(closeAction, SIGNAL("triggered()"),
                     ide.mainContainer.actualTab.close_tab)
        self.connect(exitAction, SIGNAL("triggered()"), ide.close)
        QObject.connect(reloadFileAction, SIGNAL("triggered()"),
                        ide.mainContainer.reload_file)
        self.connect(printFile, SIGNAL("triggered()"), ide.actions.print_file)
        self.connect(closeProjectsAction, SIGNAL("triggered()"),
                     ide.explorer.close_opened_projects)
        self.connect(deactivateProfileAction, SIGNAL("triggered()"),
                     ide.actions.deactivate_profile)
        self.connect(activateProfileAction, SIGNAL("triggered()"),
                     ide.actions.activate_profile)
Example #60
0
    def initValues(self):
        self.updateValues()
        for ctrl, info in self.VolumeControls.iteritems():
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateMatrixVolume)

        for ctrl, info in self.VolumeControlsLowRes.iteritems():
            QObject.connect(ctrl, SIGNAL('valueChanged(int)'),
                            self.updateLowResVolume)

        for ctrl, info in self.SelectorControls.iteritems():
            QObject.connect(ctrl, SIGNAL('stateChanged(int)'),
                            self.updateSelector)

        for ctrl, info in self.TriggerButtonControls.iteritems():
            QObject.connect(ctrl, SIGNAL('clicked()'), self.triggerButton)

        for ctrl, info in self.saveTextControls.iteritems():
            QObject.connect(ctrl, SIGNAL('clicked()'), self.saveText)

        for ctrl, info in self.ComboControls.iteritems():
            QObject.connect(ctrl, SIGNAL('activated(int)'), self.selectCombo)