Exemplo n.º 1
0
    def updateWidget(self):
        formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
        if formWindow:
            # set widget option
            formWindow.cursor().setProperty('indicator_option',
              QtCore.QVariant(self.indicatorCheckBox.isChecked()))
            formWindow.cursor().setProperty('python_command_option',
              QtCore.QVariant(self.pythonCheckBox.isChecked()))
            formWindow.cursor().setProperty('checked_state_text_option',
              QtCore.QVariant(self.textCheckBox.isChecked()))

            formWindow.cursor().setProperty('indicator_HAL_pin_option',
              QtCore.QVariant(self.halCheckBox.isChecked()))
            formWindow.cursor().setProperty('indicator_size',
              QtCore.QVariant(self.floatSpinBox.value()))
            formWindow.cursor().setProperty('indicator_size',
              QtCore.QVariant(self.floatSpinBox.value()))
            formWindow.cursor().setProperty('indicator_size',
              QtCore.QVariant(self.floatSpinBox.value()))


            formWindow.cursor().setProperty('on_color',
              QtCore.QVariant(self._onColor))
            formWindow.cursor().setProperty('off_color',
              QtCore.QVariant(self._offColor))
            formWindow.cursor().setProperty('true_python_cmd_string',
              QtCore.QVariant(self.tCommandEditBox.text()))
            formWindow.cursor().setProperty('false_python_cmd_string',
              QtCore.QVariant(self.fCommandEditBox.text()))
        self.accept()
Exemplo n.º 2
0
    def updateWidget(self):
        formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
        if formWindow:
            # set widget option
            formWindow.cursor().setProperty(
                'indicator_option',
                QtCore.QVariant(self.indicatorCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'python_command_option',
                QtCore.QVariant(self.pythonCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'checked_state_text_option',
                QtCore.QVariant(self.textCheckBox.isChecked()))

            formWindow.cursor().setProperty(
                'indicator_HAL_pin_option',
                QtCore.QVariant(self.halCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'indicator_size', QtCore.QVariant(self.floatSpinBox.value()))
            formWindow.cursor().setProperty(
                'indicator_size', QtCore.QVariant(self.floatSpinBox.value()))
            formWindow.cursor().setProperty(
                'indicator_size', QtCore.QVariant(self.floatSpinBox.value()))

            formWindow.cursor().setProperty('on_color',
                                            QtCore.QVariant(self._onColor))
            formWindow.cursor().setProperty('off_color',
                                            QtCore.QVariant(self._offColor))
            formWindow.cursor().setProperty(
                'true_python_cmd_string',
                QtCore.QVariant(self.tCommandEditBox.text()))
            formWindow.cursor().setProperty(
                'false_python_cmd_string',
                QtCore.QVariant(self.fCommandEditBox.text()))
        self.accept()
Exemplo n.º 3
0
    def updateWidget(self):
        i = self.combo.currentIndex()
        winProperty = self.combo.itemData(i, role=QtCore.Qt.UserRole + 1)
        if winProperty is None:
            self.combo.select(0, 0)
            return
        formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)

        if formWindow and winProperty == 'unused':
            formWindow.cursor().setProperty('feed_override_status',
                                            QtCore.QVariant(True))
            formWindow.cursor().setProperty('feed_override_status',
                                            QtCore.QVariant(False))
        elif formWindow:
            # set widget option
            formWindow.cursor().setProperty(winProperty + '_status',
                                            QtCore.QVariant(True))

        # set related data
        formWindow.cursor().setProperty(
            'index_number', QtCore.QVariant(self.JNumSpinBox.value()))
        # block signal so button text doesn't change when selecting action
        self.widget._designer_block_signal = True
        formWindow.cursor().setProperty(
            'textTemplate', QtCore.QVariant(self.textTemplateEditBox.text()))
        formWindow.cursor().setProperty(
            'alt_textTemplate',
            QtCore.QVariant(self.altTextTemplateEditBox.text()))
        formWindow.cursor().setProperty(
            'text', QtCore.QVariant(self.defaultTextTemplateEditBox.text()))
        self.widget._designer_block_signal = False

        self.accept()
Exemplo n.º 4
0
    def updateWidget(self):

        formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
        if formWindow:
            formWindow.cursor().setProperty(
                "estop_action", QtCore.QVariant(self.c_estop.isChecked()))

        self.accept()
Exemplo n.º 5
0
 def styleSheetChanged(self):
     widget = self.sender()
     form = QDesignerFormWindowInterface.findFormWindow(widget)
     if form:
         sheet = form.core().extensionManager().extension(
             widget, Q_TYPEID['QDesignerPropertySheetExtension'])
         sheet = sip.cast(sheet, QPyDesignerPropertySheetExtension)
         index = sheet.indexOf('styleSheet')
         sheet.setChanged(index, True)
Exemplo n.º 6
0
 def updateWidget(self):
     i = self.combo.currentIndex()
     winProperty = self.combo.itemData(i, role=QtCore.Qt.UserRole + 1)
     if winProperty is None:
         return
     formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
     if formWindow and winProperty == 'unset':
         formWindow.cursor().setProperty('estop_action',
                                         QtCore.QVariant(True))
         formWindow.cursor().setProperty('estop_action',
                                         QtCore.QVariant(False))
     elif formWindow:
         # set widget option
         formWindow.cursor().setProperty(winProperty + '_action',
                                         QtCore.QVariant(True))
         # set related data
         formWindow.cursor().setProperty(
             'joint_number', QtCore.QVariant(self.JNumSpinBox.value()))
         formWindow.cursor().setProperty(
             'incr_imperial_number',
             QtCore.QVariant(self.jogIncImpSpinBox.value()))
         formWindow.cursor().setProperty(
             'incr_mm_number',
             QtCore.QVariant(self.jogIncMMSpinBox.value()))
         formWindow.cursor().setProperty(
             'incr_angular_number',
             QtCore.QVariant(self.jogIncAngSpinBox.value()))
         formWindow.cursor().setProperty(
             'float_num', QtCore.QVariant(self.floatSpinBox.value()))
         formWindow.cursor().setProperty(
             'float_alt_num', QtCore.QVariant(self.floatAltSpinBox.value()))
         formWindow.cursor().setProperty(
             'view_type_string',
             QtCore.QVariant(self.viewComboBox.currentText()))
         formWindow.cursor().setProperty(
             'toggle_float_option',
             QtCore.QVariant(self.toggleCheckBox.isChecked()))
         formWindow.cursor().setProperty(
             'command_text_string',
             QtCore.QVariant(self.commandEditBox.text()))
         formWindow.cursor().setProperty(
             'ini_mdi_number', QtCore.QVariant(self.MDISpinBox.value()))
         formWindow.cursor().setProperty(
             'template_label_option',
             QtCore.QVariant(self.textTemplateCheckBox.isChecked()))
         # block signal so button text doesn't change when selecting action
         self.widget._designer_block_signal = True
         formWindow.cursor().setProperty(
             'textTemplate',
             QtCore.QVariant(self.textTemplateEditBox.text()))
         formWindow.cursor().setProperty(
             'alt_textTemplate',
             QtCore.QVariant(self.altTextTemplateEditBox.text()))
         self.widget._designer_block_signal = False
     self.accept()
Exemplo n.º 7
0
    def update(self):
        if not self.in_designer:
            return

        from PyQt5.QtDesigner import QDesignerFormWindowInterface

        can_file = self.can_file

        imported = ()
        new_form_window = QDesignerFormWindowInterface.findFormWindow(self)
        if self.neo is None:
            if self.form_window is not None:
                self.form_window.fileNameChanged.disconnect(
                    self.form_window_file_name_changed
                )

            self.form_window = new_form_window

            if self.form_window is not None:
                self.form_window.fileNameChanged.connect(
                    self.form_window_file_name_changed
                )

            if self.form_window is not None:
                if not os.path.isabs(can_file):
                    can_file = os.path.join(
                        os.path.dirname(self.form_window.fileName()), can_file
                    )

            try:
                imported = list(canmatrix.formats.loadp(can_file).values())
            except (FileNotFoundError, IsADirectoryError, OSError):
                # Windows raises an OSError for at least my VirtualBox
                # network drive.
                #
                # >>> f = open('W:/t/603/Hydra_06092017 - old\\'); f.close()
                # Traceback (most recent call last):
                #   File "<stdin>", line 1, in <module>
                # OSError: [Errno 22] Invalid argument: 'W:/t/603/Hydra_06092017 - old\\'
                # >>> f = open('C:/t/603/Hydra_06092017 - old\\'); f.close()
                # Traceback (most recent call last):
                #   File "<stdin>", line 1, in <module>
                # FileNotFoundError: [Errno 2] No such file or directory: 'C:/t/603/Hydra_06092017 - old\\'

                pass

        widgets = self.findChildren(epyqlib.widgets.abstractwidget.AbstractWidget)

        if len(imported) > 0:
            self.neo = epyqlib.canneo.Neo(matrix=imported[0])

        for widget in widgets:
            self.update_widget(widget=widget)
Exemplo n.º 8
0
 def pageTitleChanged(self, title):
     widget = self.sender()
     if widget and isinstance(widget, PyMultiPageWidget):
         page = widget.widget(widget.getCurrentIndex())
         form = QDesignerFormWindowInterface.findFormWindow(widget)
         if form:
             editor = form.core()
             manager = editor.extensionManager()
             sheet = manager.extension(page, Q_TYPEID['QPyDesignerPropertySheetExtension'])
             # This explicit cast is necessary here
             sheet = sip.cast(sheet, QPyDesignerPropertySheetExtension)
             propertyIndex = sheet.indexOf('windowTitle')
             sheet.setChanged(propertyIndex, True)
Exemplo n.º 9
0
 def pageTitleChanged(self, title):
     widget = self.sender()
     if widget and isinstance(widget, PyMultiPageWidget):
         page = widget.widget(widget.getCurrentIndex())
         form = QDesignerFormWindowInterface.findFormWindow(widget)
         if form:
             editor = form.core()
             manager = editor.extensionManager()
             sheet = manager.extension(page, Q_TYPEID['QPyDesignerPropertySheetExtension'])
             # This explicit cast is necessary here
             sheet = sip.cast(sheet, QPyDesignerPropertySheetExtension)
             propertyIndex = sheet.indexOf('windowTitle')
             sheet.setChanged(propertyIndex, True)
Exemplo n.º 10
0
 def __init__(self, widget, parent):
     QPyDesignerPropertySheetExtension.__init__(self, parent)
     self.widget = widget
     self.formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
     print self.formWindow
     self.propertylist=['objectName','geometry','text']
     self.temp_flag = True
     #print dir(self.widget.pyqtConfigure.__sizeof__)
     #print self.widget.pyqtConfigure.__sizeof__()
     for i in StatusLabel.__dict__:
         #print i
         if 'PyQt4.QtCore.pyqtProperty'  in str(StatusLabel.__dict__[i]):
             self.propertylist.append(i)
             print i
Exemplo n.º 11
0
 def __init__(self, widget, parent):
     QPyDesignerPropertySheetExtension.__init__(self, parent)
     self.widget = widget
     self.formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
     print self.formWindow
     self.propertylist=['objectName','geometry','text']
     self.temp_flag = True
     #print dir(self.widget.pyqtConfigure.__sizeof__)
     #print self.widget.pyqtConfigure.__sizeof__()
     for i in StatusLabel.__dict__:
         #print i
         if 'PyQt5.QtCore.pyqtProperty'  in str(StatusLabel.__dict__[i]):
             self.propertylist.append(i)
             print i
Exemplo n.º 12
0
    def __init__(self, widget, parent=None):

        QtWidgets.QDialog.__init__(self, parent)

        self.widget = widget

        self.previewWidget = ActionButton()
        #self.previewWidget.notify_option = widget.notify_option

        buttonBox = QtWidgets.QDialogButtonBox()
        okButton = buttonBox.addButton(buttonBox.Ok)
        cancelButton = buttonBox.addButton(buttonBox.Cancel)

        okButton.clicked.connect(self.updateWidget)
        cancelButton.clicked.connect(self.reject)

        layout = QtWidgets.QGridLayout()
        self.c_estop = QtWidgets.QCheckBox("Estop Action")
        self.c_estop.setChecked(widget.estop)
        layout.addWidget(self.c_estop)

        layout.addWidget(buttonBox, 5, 0, 1, 2)
        self.setLayout(layout)

        self.setWindowTitle(self.tr("Set Options"))

        return
        # well this didn't give me what I wanted
        form = QDesignerFormWindowInterface.findFormWindow(widget)
        if form:
            editor = form.core()
            manager = editor.extensionManager()
            w = editor.topLevel()
            print w
            sheet = manager.extension(
                w, Q_TYPEID['QDesignerMemberSheetExtension'])
            # This explicit cast is necessary here
            sheet = sip.cast(sheet, QPyDesignerMemberSheetExtension)
            memberCount = sheet.count()
            print widget, 'count:', memberCount
            print sheet.indexOf('clicked()')
            print sheet.indexOf('sender')
            for i in range(0, memberCount):
                #sheet.setVisible(i,False)
                if sheet.isSignal(i) or sheet.isSlot(i):
                    print i, sheet.signature(i)
Exemplo n.º 13
0
 def updateWidget(self):
     i = self.combo.currentIndex()
     winProperty = self.combo.itemData(i,role = QtCore.Qt.UserRole + 1)
     if winProperty is None:
         return
     formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
     if formWindow and winProperty =='unset':
         formWindow.cursor().setProperty('estop_action',
             QtCore.QVariant(True))
         formWindow.cursor().setProperty('estop_action',
             QtCore.QVariant(False))
     elif formWindow:
         # set widget option
         formWindow.cursor().setProperty(winProperty+'_action',
           QtCore.QVariant(True))
         # set related data
         formWindow.cursor().setProperty('joint_number',
           QtCore.QVariant(self.JNumSpinBox.value()))
         formWindow.cursor().setProperty('incr_imperial_number',
           QtCore.QVariant(self.jogIncImpSpinBox.value()))
         formWindow.cursor().setProperty('incr_mm_number',
           QtCore.QVariant(self.jogIncMMSpinBox.value()))
         formWindow.cursor().setProperty('incr_angular_number',
           QtCore.QVariant(self.jogIncAngSpinBox.value()))
         formWindow.cursor().setProperty('float_num',
           QtCore.QVariant(self.floatSpinBox.value()))
         formWindow.cursor().setProperty('float_alt_num',
           QtCore.QVariant( self.floatAltSpinBox.value()))
         formWindow.cursor().setProperty('view_type_string',
           QtCore.QVariant(self.viewComboBox.currentText()))
         formWindow.cursor().setProperty('toggle_float_option',
           QtCore.QVariant(self.toggleCheckBox.isChecked()))
         formWindow.cursor().setProperty('command_text_string',
           QtCore.QVariant(self.commandEditBox.text()))
         formWindow.cursor().setProperty('ini_mdi_number',
           QtCore.QVariant(self.MDISpinBox.value()))
         formWindow.cursor().setProperty('template_label_option',
           QtCore.QVariant(self.textTemplateCheckBox.isChecked()))
         formWindow.cursor().setProperty('textTemplate',
           QtCore.QVariant(self.textTemplateEditBox.text()))
         formWindow.cursor().setProperty('alt_textTemplate',
           QtCore.QVariant(self.altTextTemplateEditBox.text()))
     self.accept()
Exemplo n.º 14
0
   def updateWidget(self):

      formWindow = \
        QDesignerFormWindowInterface.findFormWindow(
            self.widget)

      if formWindow:
          formWindow.cursor().setProperty("notify_option",
              QtCore.QVariant(self.c_notify.isChecked()))
          formWindow.cursor().setProperty("catch_errors_option",
              QtCore.QVariant(self.c_errors.isChecked()))
          formWindow.cursor().setProperty("catch_close_option",
              QtCore.QVariant(self.c_close.isChecked()))
          formWindow.cursor().setProperty("play_sounds_option",
              QtCore.QVariant(self.c_play_sounds.isChecked()))
          formWindow.cursor().setProperty("use_pref_file_option",
              QtCore.QVariant(self.c_use_pref_file.isChecked()))

      self.accept()
Exemplo n.º 15
0
    def updateWidget(self):
        formWindow = \
            QDesignerFormWindowInterface.findFormWindow(
                self.widget)

        if formWindow:
            formWindow.cursor().setProperty("notify_option",
                                            QtCore.QVariant(self.c_notify.isChecked()))
            formWindow.cursor().setProperty("notify_max_messages",
                                            QtCore.QVariant(self.c_notify_max_msgs.value()))
            formWindow.cursor().setProperty("catch_errors_option",
                                            QtCore.QVariant(self.c_errors.isChecked()))
            formWindow.cursor().setProperty("catch_close_option",
                                            QtCore.QVariant(self.c_close.isChecked()))
            formWindow.cursor().setProperty("play_sounds_option",
                                            QtCore.QVariant(self.c_play_sounds.isChecked()))
            formWindow.cursor().setProperty("use_pref_file_option",
                                            QtCore.QVariant(self.c_use_pref_file.isChecked()))
            formWindow.cursor().setProperty("halCompBaseName",
                                            QtCore.QVariant(self.e_hal_base_name.text()))
        self.accept()
Exemplo n.º 16
0
    def updateWidget(self):
        formWindow = \
            QDesignerFormWindowInterface.findFormWindow(
                self.widget)

        if formWindow:
            formWindow.cursor().setProperty(
                "notify_option", QtCore.QVariant(self.c_notify.isChecked()))
            formWindow.cursor().setProperty(
                "catch_errors_option",
                QtCore.QVariant(self.c_errors.isChecked()))
            formWindow.cursor().setProperty(
                "catch_close_option",
                QtCore.QVariant(self.c_close.isChecked()))
            formWindow.cursor().setProperty(
                "play_sounds_option",
                QtCore.QVariant(self.c_play_sounds.isChecked()))
            formWindow.cursor().setProperty(
                "use_pref_file_option",
                QtCore.QVariant(self.c_use_pref_file.isChecked()))

        self.accept()
Exemplo n.º 17
0
 def currentIndexChanged(self, index):
     widget = self.sender()
     if widget and isinstance(widget, PyMultiPageWidget):
         form = QDesignerFormWindowInterface.findFormWindow(widget)
         if form:
             form.emitSelectionChanged()
Exemplo n.º 18
0
    def updateWidget(self):
        # check action-combobox last pick because it sometimes
        # forgets whats selected. anyways...
        winProperty = self.combo.getLastPick()
        if winProperty is None:
            self.tab.setCurrentIndex(0)
            return
        formWindow = QDesignerFormWindowInterface.findFormWindow(self.widget)
        if formWindow:
            # set widget option
            formWindow.cursor().setProperty(
                'indicator_option',
                QtCore.QVariant(self.indicatorCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'python_command_option',
                QtCore.QVariant(self.pythonCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'checked_state_text_option',
                QtCore.QVariant(self.textCheckBox.isChecked()))

            formWindow.cursor().setProperty(
                'indicator_HAL_pin_option',
                QtCore.QVariant(self.halCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'indicator_status_option',
                QtCore.QVariant(self.statusCheckBox.isChecked()))
            formWindow.cursor().setProperty(
                'indicator_size', QtCore.QVariant(self.floatSpinBox.value()))
            formWindow.cursor().setProperty(
                'circle_diameter', QtCore.QVariant(self.diamSpinBox.value()))
            formWindow.cursor().setProperty(
                'shape_option',
                QtCore.QVariant(
                    self.shapeCombo.itemData(self.shapeCombo.currentIndex())))
            formWindow.cursor().setProperty(
                'joint_number_status',
                QtCore.QVariant(
                    self.jnumCombo.itemData(self.jnumCombo.currentIndex())))

            formWindow.cursor().setProperty('on_color',
                                            QtCore.QVariant(self._onColor))
            formWindow.cursor().setProperty('off_color',
                                            QtCore.QVariant(self._offColor))

            formWindow.cursor().setProperty(
                'true_state_string', QtCore.QVariant(self.tTextEditBox.text()))
            formWindow.cursor().setProperty(
                'false_state_string',
                QtCore.QVariant(self.fTextEditBox.text()))

            formWindow.cursor().setProperty(
                'true_python_cmd_string',
                QtCore.QVariant(self.tCommandEditBox.text()))
            formWindow.cursor().setProperty(
                'false_python_cmd_string',
                QtCore.QVariant(self.fCommandEditBox.text()))

        if formWindow and winProperty == 'unused':
            formWindow.cursor().setProperty('estop_action',
                                            QtCore.QVariant(True))
            formWindow.cursor().setProperty('estop_action',
                                            QtCore.QVariant(False))
        elif formWindow:
            # set widget option
            formWindow.cursor().setProperty(winProperty + '_action',
                                            QtCore.QVariant(True))
        # set status data fom combo box
        # we read all data from combo and set each property to its
        # current dialog state (ie. selected is true, all others false)
        for i in range(1, self.statusCombo.count()):
            data = self.statusCombo.itemData(i, QtCore.Qt.UserRole + 1)
            propertyText = '{}_status'.format(data)
            if self.statusCombo.itemData(self.statusCombo.currentIndex(),
                                         QtCore.Qt.UserRole + 1) == data:
                state = True
            else:
                state = False
            formWindow.cursor().setProperty(propertyText,
                                            QtCore.QVariant(state))
        formWindow.cursor().setProperty(
            'invert_the_status',
            QtCore.QVariant(self.invertCheckBox.isChecked()))

        #####################
        # set related data
        #####################
        formWindow.cursor().setProperty(
            'joint_number', QtCore.QVariant(self.JNumSpinBox.value()))
        formWindow.cursor().setProperty(
            'incr_imperial_number',
            QtCore.QVariant(self.jogIncImpSpinBox.value()))
        formWindow.cursor().setProperty(
            'incr_mm_number', QtCore.QVariant(self.jogIncMMSpinBox.value()))
        formWindow.cursor().setProperty(
            'incr_angular_number',
            QtCore.QVariant(self.jogIncAngSpinBox.value()))
        formWindow.cursor().setProperty(
            'float_num', QtCore.QVariant(self.floatSpinBox.value()))
        formWindow.cursor().setProperty(
            'float_alt_num', QtCore.QVariant(self.floatAltSpinBox.value()))
        formWindow.cursor().setProperty(
            'view_type_string',
            QtCore.QVariant(self.viewComboBox.currentText()))
        formWindow.cursor().setProperty(
            'toggle_float_option',
            QtCore.QVariant(self.toggleCheckBox.isChecked()))
        formWindow.cursor().setProperty(
            'command_text_string', QtCore.QVariant(self.commandEditBox.text()))
        formWindow.cursor().setProperty(
            'ini_mdi_number', QtCore.QVariant(self.MDISpinBox.value()))
        formWindow.cursor().setProperty(
            'template_label_option',
            QtCore.QVariant(self.textTemplateCheckBox.isChecked()))
        # block signal so button text doesn't change when selecting action
        self.widget._designer_block_signal = True
        formWindow.cursor().setProperty(
            'text', QtCore.QVariant(self.defaultTextTemplateEditBox.text()))
        formWindow.cursor().setProperty(
            'textTemplate', QtCore.QVariant(self.textTemplateEditBox.text()))
        formWindow.cursor().setProperty(
            'alt_textTemplate',
            QtCore.QVariant(self.altTextTemplateEditBox.text()))
        self.widget._designer_block_signal = False

        self.accept()
Exemplo n.º 19
0
 def currentIndexChanged(self, index):
     widget = self.sender()
     if widget and isinstance(widget, PyMultiPageWidget):
         form = QDesignerFormWindowInterface.findFormWindow(widget)
         if form:
             form.emitSelectionChanged()