Пример #1
0
 def __init__(self, parent=None):
     super(MacroTabDialog, self).__init__(parent)
     self.setWindowTitle('Qtvcp Macro Menu')
     self._color = QColor(0, 0, 0, 150)
     self._state = False
     self._request_name = 'MACROTAB'
     self.setWindowModality(Qt.ApplicationModal)
     self.setWindowFlags(self.windowFlags() | Qt.Tool | Qt.Dialog
                         | Qt.WindowStaysOnTopHint
                         | Qt.WindowSystemMenuHint)
     self.setMinimumSize(00, 200)
     self.resize(600, 400)
     # patch class to call our button methods rather then the
     # original methods (Gotta do before instantiation)
     MacroTab.closeChecked = self._close
     MacroTab.runChecked = self._run
     MacroTab.setTitle = self._setTitle
     # ok now instantiate patched class
     self.tab = MacroTab()
     self.tab.setObjectName('macroTabInternal_')
     l = QVBoxLayout()
     self.setLayout(l)
     l.addWidget(self.tab)
     #we need the close button
     self.tab.closeButton.setVisible(True)
Пример #2
0
    def __init__(self, parent=None):
        super(MacroTabDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self._state = False

        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowFlags(self.windowFlags() | Qt.Tool |
                            Qt.Dialog |
                            Qt.WindowStaysOnTopHint | Qt.WindowSystemMenuHint)
        self.setMinimumSize(00, 200)
        self.resize(600, 400)
        # patch class to call our button methods rather then the
        # original methods (Gotta do before instantiation)
        MacroTab.closeChecked = self._close
        MacroTab.runChecked = self._run
        # ok now instantiate patched class
        self.tab = MacroTab()
        l = QVBoxLayout()
        self.setLayout(l)
        l.addWidget(self.tab)
        #we need the close button
        self.tab.closeButton.setVisible(True)
Пример #3
0
class MacroTabDialog(QDialog, _HalWidgetBase):
    def __init__(self, parent=None):
        super(MacroTabDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self._state = False

        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowFlags(self.windowFlags() | Qt.Tool |
                            Qt.Dialog |
                            Qt.WindowStaysOnTopHint | Qt.WindowSystemMenuHint)
        self.setMinimumSize(00, 200)
        self.resize(600, 400)
        # patch class to call our button methods rather then the
        # original methods (Gotta do before instantiation)
        MacroTab.closeChecked = self._close
        MacroTab.runChecked = self._run
        # ok now instantiate patched class
        self.tab = MacroTab()
        l = QVBoxLayout()
        self.setLayout(l)
        l.addWidget(self.tab)
        #we need the close button
        self.tab.closeButton.setVisible(True)

    def _hal_init(self):
        x = self.geometry().x()
        y = self.geometry().y()
        w = self.geometry().width()
        h = self.geometry().height()
        geo = '%s %s %s %s'% (x,y,w,h)
        self._default_geometry=[x,y,w,h]
        if self.PREFS_:
            self._geometry_string = self.PREFS_.getpref('MacroTabDialog-geometry', geo, str, 'DIALOG_OPTIONS')
        else:
            self._geometry_string = 'default'
        # gotta call this since we instantiated this out of qtvcp's knowledge
        self.tab._hal_init()
        self.topParent = self.QTVCP_INSTANCE_
        STATUS.connect('dialog-request', self._external_request)

    def _external_request(self, w, cmd):
        if cmd == 'MACRO':
            self.load_dialog()

    # This method is called instead of MacroTab's closeChecked method
    # we do this so we can use it's buttons to hide our dialog
    # rather then close the MacroTab widget
    def _close(self):
        self.close()

    # This method is called instead of MacroTab's runChecked() method
    # we do this so we can use it's buttons to hide our dialog
    # rather then close the MacroTab widget
    def _run(self):
        self.tab.runMacro()
        self.close()

    def load_dialog(self):
        STATUS.emit('focus-overlay-changed', True, 'Lathe Macro Dialog', self._color)
        self.tab.stack.setCurrentIndex(0)
        self.calculate_placement()
        self.show()
        self.exec_()
        STATUS.emit('focus-overlay-changed', False, None, None)
        record_geometry(self,'MacroTabDialog-geometry')

    def calculate_placement(self):
        geometry_parsing(self,'MacroTabDialog-geometry')

    # **********************
    # Designer properties
    # **********************

    @pyqtSlot(bool)
    def setState(self, value):
        self._state = value
        if value:
            self.show()
        else:
            self.hide()
    def getState(self):
        return self._state
    def resetState(self):
        self._state = False

    def getColor(self):
        return self._color
    def setColor(self, value):
        self._color = value
    def resetState(self):
        self._color = QColor(0, 0, 0, 150)

    state = pyqtProperty(bool, getState, setState, resetState)
    overlay_color = pyqtProperty(QColor, getColor, setColor)
Пример #4
0
 def createWidget(self, parent):
     return MacroTab(parent)
Пример #5
0
class MacroTabDialog(QDialog, _HalWidgetBase):
    def __init__(self, parent=None):
        super(MacroTabDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self._state = False
        self._request_name = 'MACROTAB'

        self.setWindowModality(Qt.ApplicationModal)
        self.setWindowFlags(self.windowFlags() | Qt.Tool | Qt.Dialog
                            | Qt.WindowStaysOnTopHint
                            | Qt.WindowSystemMenuHint)
        self.setMinimumSize(00, 200)
        self.resize(600, 400)
        # patch class to call our button methods rather then the
        # original methods (Gotta do before instantiation)
        MacroTab.closeChecked = self._close
        MacroTab.runChecked = self._run
        # ok now instantiate patched class
        self.tab = MacroTab()
        l = QVBoxLayout()
        self.setLayout(l)
        l.addWidget(self.tab)
        #we need the close button
        self.tab.closeButton.setVisible(True)

    def _hal_init(self):
        x = self.geometry().x()
        y = self.geometry().y()
        w = self.geometry().width()
        h = self.geometry().height()
        geo = '%s %s %s %s' % (x, y, w, h)
        self._default_geometry = [x, y, w, h]
        if self.PREFS_:
            self._geometry_string = self.PREFS_.getpref(
                'MacroTabDialog-geometry', geo, str, 'DIALOG_OPTIONS')
        else:
            self._geometry_string = 'default'
        # gotta call this since we instantiated this out of qtvcp's knowledge
        self.tab._hal_init()
        self.topParent = self.QTVCP_INSTANCE_
        STATUS.connect('dialog-request', self._external_request)

    def _external_request(self, w, message):
        if message['NAME'] == self._request_name:
            self.load_dialog()

    # This method is called instead of MacroTab's closeChecked method
    # we do this so we can use it's buttons to hide our dialog
    # rather then close the MacroTab widget
    def _close(self):
        self.close()

    # This method is called instead of MacroTab's runChecked() method
    # we do this so we can use it's buttons to hide our dialog
    # rather then close the MacroTab widget
    def _run(self):
        self.tab.runMacro()
        self.close()

    def load_dialog(self):
        STATUS.emit('focus-overlay-changed', True, 'Lathe Macro Dialog',
                    self._color)
        self.tab.stack.setCurrentIndex(0)
        self.calculate_placement()
        self.show()
        self.exec_()
        STATUS.emit('focus-overlay-changed', False, None, None)
        record_geometry(self, 'MacroTabDialog-geometry')

    def calculate_placement(self):
        geometry_parsing(self, 'MacroTabDialog-geometry')

    # **********************
    # Designer properties
    # **********************

    @pyqtSlot(bool)
    def setState(self, value):
        self._state = value
        if value:
            self.show()
        else:
            self.hide()

    def getState(self):
        return self._state

    def resetState(self):
        self._state = False

    def getColor(self):
        return self._color

    def setColor(self, value):
        self._color = value

    def resetState(self):
        self._color = QColor(0, 0, 0, 150)

    state = pyqtProperty(bool, getState, setState, resetState)
    overlay_color = pyqtProperty(QColor, getColor, setColor)