def __init__(self, widget, parent = None):
        QtWidgets.QDialog.__init__(self, parent)

        self.setWindowTitle(self.tr("Set Options"))
        self.setGeometry(300, 300, 300, 300)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred)
        self.widget = widget
        self.previewWidget = ActionButton()

        self.tab = QtWidgets.QTabWidget()
        self.tab1 = QtWidgets.QWidget()
        self.tab2 = QtWidgets.QWidget()
        self.tab3 = QtWidgets.QWidget()

        self.tab.addTab(self.tab1,'Actions')
        self.tab.addTab(self.tab2,'LED')
        self.tab.addTab(self.tab3,'Other')
        self.buildtab1()
        self.buildtab2()
        self.buildtab3()

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(self.tab)

        wid = QtWidgets.QWidget()
        vbox2 = QtWidgets.QVBoxLayout(wid)
        self.defaultTextTemplateEditBox = QtWidgets.QLineEdit()
        self.defaultTextTemplateEditBox.setText(self.widget.text())

        hbox = QtWidgets.QHBoxLayout()
        label = QtWidgets.QLabel('Default Text Template')
        hbox.addWidget(label)
        dialogButton = QtWidgets.QPushButton('RichText Editor')
        dialogButton.clicked.connect(lambda :self.launchDialog(self.defaultTextTemplateEditBox))
        hbox.addWidget(dialogButton)
        vbox2.addLayout(hbox)

        vbox2.addWidget(self.defaultTextTemplateEditBox)
        vbox.addWidget(wid)

        # Dialog control buttons
        buttonBox = QtWidgets.QDialogButtonBox()
        okButton = buttonBox.addButton(buttonBox.Ok)
        cancelButton = buttonBox.addButton(buttonBox.Cancel)
        okButton.clicked.connect(self.updateWidget)
        cancelButton.clicked.connect(self.reject)
        vbox.addWidget(buttonBox, 1)
        self.setLayout(vbox)

        self.onSetOptions()
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
    def __init__(self, widget, parent=None):
        QtWidgets.QDialog.__init__(self, parent)

        self.setWindowTitle(self.tr("Set Options"))
        self.setGeometry(300, 300, 200, 200)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)
        self.widget = widget
        self.previewWidget = ActionButton()

        tab = QtWidgets.QTabWidget()
        self.tab1 = QtWidgets.QWidget()
        self.tab2 = QtWidgets.QWidget()

        tab.addTab(self.tab1, 'Actions')
        tab.addTab(self.tab2, 'Indicator Action')
        self.buildtab1()
        self.buildtab2()

        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(tab)

        wid = QtWidgets.QWidget()
        vbox2 = QtWidgets.QVBoxLayout(wid)
        label = QtWidgets.QLabel('Default Text Template')
        self.defaultTextTemplateEditBox = QtWidgets.QLineEdit()
        self.defaultTextTemplateEditBox.setText(self.widget.text())
        vbox2.addWidget(label)
        vbox2.addWidget(self.defaultTextTemplateEditBox)
        vbox.addWidget(wid)

        # Dialog control buttons
        buttonBox = QtWidgets.QDialogButtonBox()
        okButton = buttonBox.addButton(buttonBox.Ok)
        cancelButton = buttonBox.addButton(buttonBox.Cancel)
        okButton.clicked.connect(self.updateWidget)
        cancelButton.clicked.connect(self.reject)
        vbox.addWidget(buttonBox, 1)
        self.setLayout(vbox)

        self.onSetOptions()
Ejemplo n.º 4
0
    def __init__(self, widget, parent=None):
        QtWidgets.QDialog.__init__(self, parent)

        self.setGeometry(300, 300, 300, 200)
        self.widget = widget
        self.previewWidget = ActionButton()
        self.setWindowTitle(self.tr("Set Indicator Options"))

        layout = QtWidgets.QGridLayout()

        # Indicator option
        self.ud1 = QtWidgets.QFrame()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('<b>State Indicator Option<\b>')
        self.indicatorCheckBox = QtWidgets.QCheckBox()
        self.indicatorCheckBox.setChecked(widget.draw_indicator)
        self.indicatorCheckBox.clicked.connect(self.onSetOptions)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.indicatorCheckBox)
        self.ud1.setLayout(hbox)
        layout.addWidget(self.ud1)
        #self.ud1.hide()

        # HAL pin option
        self.ud4 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Hal Pin Option')
        self.halCheckBox = QtWidgets.QCheckBox()
        self.halCheckBox.setChecked(widget._HAL_pin)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.halCheckBox)
        self.ud4.setLayout(hbox)
        layout.addWidget(self.ud4)
        self.ud4.hide()

        # indicator size
        self.ud256 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Indicator Size')
        self.floatSpinBox = QtWidgets.QDoubleSpinBox()
        self.floatSpinBox.setRange(0, 2)
        self.floatSpinBox.setDecimals(4)
        self.floatSpinBox.setSingleStep(0.1)
        self.floatSpinBox.setValue(widget._size)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.floatSpinBox)
        self.ud256.setLayout(hbox)
        layout.addWidget(self.ud256)
        self.ud256.hide()

        # true state indicator color
        self.ud512 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        button = QtWidgets.QLabel('True State Indicator Color')
        self.trueColorButton = QtWidgets.QPushButton()
        self.trueColorButton.setToolTip('Opens color dialog')
        self.trueColorButton.clicked.connect(self.on_trueColorClick)
        self.trueColorButton.setStyleSheet(
            'QPushButton {background-color: %s ;}' % widget._on_color.name())
        self._onColor = widget._on_color.name()
        hbox.addWidget(button)
        hbox.addWidget(self.trueColorButton)
        self.ud512.setLayout(hbox)
        layout.addWidget(self.ud512)
        self.ud512.hide()

        # False state indicator color
        self.ud1024 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        button = QtWidgets.QLabel('Falsee State Indicator Color')
        self.falseColorButton = QtWidgets.QPushButton()
        self.falseColorButton.setToolTip('Opens color dialog')
        self.falseColorButton.clicked.connect(self.on_falseColorClick)
        self.falseColorButton.setStyleSheet(
            'QPushButton {background-color: %s ;}' % widget._off_color.name())
        self._offColor = widget._off_color.name()
        hbox.addWidget(button)
        hbox.addWidget(self.falseColorButton)
        self.ud1024.setLayout(hbox)
        layout.addWidget(self.ud1024)
        self.ud1024.hide()

        # State Text option
        self.ud2 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('<b>State Text Option<\b?')
        self.textCheckBox = QtWidgets.QCheckBox()
        self.textCheckBox.setChecked(widget._state_text)
        self.textCheckBox.clicked.connect(self.onSetOptions)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.textCheckBox)
        self.ud2.setLayout(hbox)
        layout.addWidget(self.ud2)
        #self.ud2.hide()

        # True text edit box
        self.ud64 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('True State Text Line')
        self.tTextEditBox = QtWidgets.QLineEdit()
        self.tTextEditBox.setText(widget._true_string)
        vbox.addWidget(label)
        vbox.addWidget(self.tTextEditBox)
        self.ud64.setLayout(vbox)
        layout.addWidget(self.ud64)
        self.ud64.hide()

        # False text edit box
        self.ud128 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('False State Text Line')
        self.fTextEditBox = QtWidgets.QLineEdit()
        self.fTextEditBox.setText(widget._false_string)
        vbox.addWidget(label)
        vbox.addWidget(self.fTextEditBox)
        self.ud128.setLayout(vbox)
        layout.addWidget(self.ud128)
        self.ud128.hide()

        # Python Text option
        self.ud8 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('<b>Python Command Option<\b>')
        self.pythonCheckBox = QtWidgets.QCheckBox()
        self.pythonCheckBox.setChecked(widget._python_command)
        self.pythonCheckBox.clicked.connect(self.onSetOptions)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.pythonCheckBox)
        self.ud8.setLayout(hbox)
        layout.addWidget(self.ud8)
        #self.ud8.hide()

        # True command edit box
        self.ud16 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('True State Command Line')
        self.tCommandEditBox = QtWidgets.QLineEdit()
        self.tCommandEditBox.setText(widget.true_python_command)
        vbox.addWidget(label)
        vbox.addWidget(self.tCommandEditBox)
        self.ud16.setLayout(vbox)
        layout.addWidget(self.ud16)
        self.ud16.hide()

        # False command edit box
        self.ud32 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('False State Command Line')
        self.fCommandEditBox = QtWidgets.QLineEdit()
        self.fCommandEditBox.setText(widget.false_python_command)
        vbox.addWidget(label)
        vbox.addWidget(self.fCommandEditBox)
        self.ud32.setLayout(vbox)
        layout.addWidget(self.ud32)
        self.ud32.hide()

        # Dialog control buttons
        buttonBox = QtWidgets.QDialogButtonBox()
        okButton = buttonBox.addButton(buttonBox.Ok)
        cancelButton = buttonBox.addButton(buttonBox.Cancel)
        okButton.clicked.connect(self.updateWidget)
        cancelButton.clicked.connect(self.reject)
        layout.addWidget(buttonBox, 11, 0, 1, 2)

        self.setLayout(layout)
        self.onSetOptions()
Ejemplo n.º 5
0
 def createWidget(self, parent):
     return ActionButton(parent)
Ejemplo n.º 6
0
    def __init__(self, widget, parent=None):
        QtWidgets.QDialog.__init__(self, parent)

        self.setGeometry(300, 300, 200, 200)
        self.setSizePolicy(QtWidgets.QSizePolicy.Minimum,
                           QtWidgets.QSizePolicy.Minimum)
        self.widget = widget
        self.previewWidget = ActionButton()

        self.combo = TreeComboBox()
        model = QtGui.QStandardItemModel()
        model.setHeaderData(0, QtCore.Qt.Horizontal, 'Name',
                            QtCore.Qt.DisplayRole)

        # (('Displayed name',['widget property name', code to show related data],[])
        node_1 = (('Estop', ['estop',
                             0], []), ('Machine On', ['machine_on', 0], []),
                  ('Home', ['home', 1], []), ('Run', ['run', 0], []),
                  ('Abort', ['abort', 0], []), ('Pause', ['pause', 0], []),
                  ('Override Limits', ['limits_override', 0],
                   []), ('Zero Axis', ['zero_axis', 1],
                         []), ('Block Delete', ['block_delete', 0],
                               []), ('Optional Stop', ['optional_stop', 0],
                                     []), ('Food Coolant', ['flood', 0], []),
                  ('Mist Coolant', ['mist',
                                    0], []), ('Exit Screen', ['exit', 0], []))
        node_2 = (('Jog Joint Positive', ['jog_joint_pos', 1],
                   []), ('Jog Joint Negative', ['jog_joint_neg', 1], []),
                  ('Jog Selected Positive', ['jog_selected_pos', 0],
                   []), ('Jog Selected Negative', ['jog_selected_neg', 0],
                         []), ('Jog Increment', ['jog_incr', 1038],
                               []), ('Jog Rate', ['jog_rate', 112], []))
        node_3 = (('Load Dialog', ['load_dialog', 0],
                   []), ('Macro Dialog', ['macro_dialog', 0],
                         []), ('CamView Dialog', ['camview_dialog', 0], []),
                  ('Origin Offset Dialog', ['origin_offset_dialog', 0], []))
        node_4 = (('Launch HALmeter', ['launch_halmeter', 0],
                   []), ('Launch Status', ['launch_status', 0],
                         []), ('Launch HALshow', ['launch_halshow', 0], []),
                  ('Launch HALscope', ['launch_halscope', 0], []))
        node_5 = (('Set MDI Mode', ['mdi',
                                    0], []), ('Set Auto Mode', ['auto',
                                                                0], []),
                  ('Set Manual Mode', ['manual', 0], []))
        node_6 = (('Set Feed Override', ['feed_over', 112],
                   []), ('Set Rapid Override', ['rapid_over', 112], []),
                  ('Set Spindle Override', ['spindle_over', 112], []),
                  ('Set Max Velocity Override', ['max_velocity_over',
                                                 112], []))
        node_7 = (('Set Spindle Forward', ['spindle_fwd', 0],
                   []), ('Set Spindle Reverse', ['spindle_rev', 0],
                         []), ('Set Spindle Stop', ['spindle_stop', 0],
                               []), ('Set Spindle Up', ['spindle_up', 0], []),
                  ('Set Spindle Down', ['spindle_down', 0], []))
        node_8 = (
            ('Set DRO to Relative', ['dro_relative', 0], []),
            ('Set DRO to Absolute', ['dro_absolute', 0], []),
            ('Set DRO to DTG', ['dro_dtg', 0], []),
        )
        node_9 = (('View Change', ['view_change', 128], []), )
        node_10 = (('MDI Commands', ['mdi_command', 256], []),
                   ('MDI Commands From INI', ['ini_mdi_command', 512], []))

        parent_node = [('Unset', ['unset', None], []),
                       ('MACHINE CONTROL', [None, None], node_1),
                       ('JOGGING CONTROLS', [None, None], node_2),
                       ('DIALOG LAUNCH', [None, None], node_3),
                       ('LAUNCH PROGRAMS', [None, None], node_4),
                       ('MODE SETTING', [None, None], node_5),
                       ('OVERRIDE SETTING', [None, None], node_6),
                       ('SPINDLE CONTROLS', [None, None], node_7),
                       ('DRO CONTROL', [None, None], node_8),
                       ('GRAPHIC CONTROLS', [None, None], node_9),
                       ('MDI', [None, None], node_10)]

        self.combo.addItems(model, parent_node)
        self.combo.setModel(model)
        #self.combo.view().hideColumn (1)
        #self.combo.resize(300, 30)
        self.combo.currentIndexChanged.connect(self.selectionChanged)

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.combo)

        # related data selection - note the name 'self.ud' uses a number
        # that doubles each time - binary coded. thsi is so we can specify
        # multiple selectors  code 1 give ud1, code 2 gives ud2, code 3 gives
        # ud1 and ud2 etc

        # Joint number selection
        self.ud1 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Joint/axis number')
        self.JNumSpinBox = QtWidgets.QSpinBox()
        self.JNumSpinBox.setRange(-1, 8)
        self.JNumSpinBox.setValue(widget.joint_number)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.JNumSpinBox)
        self.ud1.setLayout(hbox)
        layout.addWidget(self.ud1)
        self.ud1.hide()

        # Jog imperial increment
        self.ud2 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Jog Increment Imperial')
        self.jogIncImpSpinBox = QtWidgets.QDoubleSpinBox()
        self.jogIncImpSpinBox.setRange(-1, 1000)
        self.jogIncImpSpinBox.setDecimals(4)
        self.jogIncImpSpinBox.setValue(widget.jog_incr_imperial)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.jogIncImpSpinBox)
        self.ud2.setLayout(hbox)
        layout.addWidget(self.ud2)
        self.ud2.hide()

        # Jog mm increment
        self.ud4 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Jog Increment mm')
        self.jogIncMMSpinBox = QtWidgets.QDoubleSpinBox()
        self.jogIncMMSpinBox.setRange(-1, 100000)
        self.jogIncMMSpinBox.setDecimals(4)
        self.jogIncMMSpinBox.setValue(widget.jog_incr_mm)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.jogIncMMSpinBox)
        self.ud4.setLayout(hbox)
        layout.addWidget(self.ud4)
        self.ud4.hide()

        # Jog Angular Increments
        self.ud8 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Jog Increment Angular')
        self.jogIncAngSpinBox = QtWidgets.QDoubleSpinBox()
        self.jogIncAngSpinBox.setRange(-1, 100000)
        self.jogIncAngSpinBox.setDecimals(4)
        self.jogIncAngSpinBox.setValue(widget.jog_incr_angle)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.jogIncAngSpinBox)
        self.ud8.setLayout(hbox)
        layout.addWidget(self.ud8)
        self.ud8.hide()

        # float
        self.ud16 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Float')
        self.floatSpinBox = QtWidgets.QDoubleSpinBox()
        self.floatSpinBox.setRange(-1000, 1000)
        self.floatSpinBox.setDecimals(4)
        self.floatSpinBox.setValue(widget.float)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.floatSpinBox)
        self.ud16.setLayout(hbox)
        layout.addWidget(self.ud16)
        self.ud16.hide()

        # Alternate float
        self.ud32 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Alternate Float')
        self.floatAltSpinBox = QtWidgets.QDoubleSpinBox()
        self.floatAltSpinBox.setRange(-1000, 1000)
        self.floatAltSpinBox.setDecimals(4)
        self.floatAltSpinBox.setValue(widget.float_alt)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.floatAltSpinBox)
        self.ud32.setLayout(hbox)
        layout.addWidget(self.ud32)
        self.ud32.hide()

        # Toggle float option
        self.ud64 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Toggle Float Option')
        self.toggleCheckBox = QtWidgets.QCheckBox()
        self.toggleCheckBox.setChecked(widget.toggle_float)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.toggleCheckBox)
        self.ud64.setLayout(hbox)
        layout.addWidget(self.ud64)
        self.ud64.hide()

        # View
        self.ud128 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Graphics View')
        self.viewComboBox = QtWidgets.QComboBox()
        flag = 0
        for num, i in enumerate(
            ('P', 'X', 'Y', 'Y2', 'Z', 'Z2', 'Clear', 'zoom-in', 'zoom-out',
             'pan-up', 'pan-down', 'pan-left', 'pan-right', 'rotate-up',
             'rotate-down', 'rotate-cw', 'rotate-ccw')):
            if widget.view_type.lower() == i.lower():
                flag = num
            self.viewComboBox.addItem(i)
        self.viewComboBox.setCurrentIndex(flag)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.viewComboBox)
        self.ud128.setLayout(hbox)
        layout.addWidget(self.ud128)
        self.ud128.hide()

        # MDI command edit box
        self.ud256 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('MDI Command Line')
        self.commandEditBox = QtWidgets.QLineEdit()
        self.commandEditBox.setText(widget.command_text)
        vbox.addWidget(label)
        vbox.addWidget(self.commandEditBox)
        self.ud256.setLayout(vbox)
        layout.addWidget(self.ud256)
        self.ud256.hide()

        # MDI command from INI edit box
        self.ud512 = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('MDI Command from INI File')
        self.MDISpinBox = QtWidgets.QSpinBox()
        self.MDISpinBox.setRange(0, 50)
        #self.MDISpinBox.setValue(widget.INI_MDI_number)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.MDISpinBox)
        self.ud512.setLayout(hbox)
        layout.addWidget(self.ud512)
        self.ud512.hide()

        # text template edit box
        self.ud1024 = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        hbox = QtWidgets.QHBoxLayout()
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Template Label Option')
        self.textTemplateCheckBox = QtWidgets.QCheckBox()
        self.textTemplateCheckBox.setChecked(widget.template_label)
        self.textTemplateCheckBox.clicked.connect(self.onSetOptions)
        hbox.addWidget(label)
        hbox.addStretch(1)
        hbox.addWidget(self.textTemplateCheckBox)
        vbox.addLayout(hbox)

        self.vbox = QtWidgets.QWidget()
        vbox2 = QtWidgets.QVBoxLayout(self.vbox)
        label = QtWidgets.QLabel('Imperial Text Template')
        self.textTemplateEditBox = QtWidgets.QLineEdit()
        self.textTemplateEditBox.setText(widget._textTemplate)
        vbox2.addWidget(label)
        vbox2.addWidget(self.textTemplateEditBox)

        label = QtWidgets.QLabel('Metric Text Template')
        self.altTextTemplateEditBox = QtWidgets.QLineEdit()
        self.altTextTemplateEditBox.setText(widget._alt_textTemplate)
        vbox2.addWidget(label)
        vbox2.addWidget(self.altTextTemplateEditBox)
        vbox.addWidget(self.vbox)

        self.ud1024.setLayout(vbox)
        layout.addWidget(self.ud1024)
        self.ud1024.hide()

        # Dialog control buttons
        buttonBox = QtWidgets.QDialogButtonBox()
        okButton = buttonBox.addButton(buttonBox.Ok)
        cancelButton = buttonBox.addButton(buttonBox.Cancel)
        okButton.clicked.connect(self.updateWidget)
        cancelButton.clicked.connect(self.reject)
        layout.addWidget(buttonBox, 1)

        self.setLayout(layout)

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

        # set combo to currently set property
        # widget[cdata[1][0]] will tell us the widgets property state
        # eg widget.estop or widget.machine_on
        flag = False
        for pnum, pdata in enumerate(parent_node):
            if pdata[0]:
                for cnum, cdata in enumerate(pdata[2]):
                    #print 'child,state:',cdata[1][0],widget[cdata[1][0]]
                    if widget[cdata[1][0]]:
                        flag = True
                        #print 'found index:',pnum,cnum
                        break
            if flag:
                break
        if flag:
            self.combo.select(pnum, cnum)
        self.onSetOptions()
Ejemplo n.º 7
0
 def createWidget(self, parent):
     a = ActionButton(parent)
     a._designer_running = True
     return a