コード例 #1
0
ファイル: dialog_widget.py プロジェクト: LinuxCNC/linuxcnc
    def __init__(self, parent=None):
        super(EntryDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self.play_sound = False
        self._request_name = 'ENTRY'
        self.title = 'Numerical Entry'
        self.setWindowFlags(self.windowFlags() | Qt.Tool |
                            Qt.Dialog | Qt.WindowStaysOnTopHint |
                            Qt.WindowSystemMenuHint)

        l = QVBoxLayout()
        self.setLayout(l)

        o = TouchInputWidget()
        l.addWidget(o)

        self.Num = QLineEdit()
        # actiate touch input
        self.Num.keyboard_type = 'numeric'
        self.Num.returnPressed.connect(lambda: self.accept())

        gl = QVBoxLayout()
        gl.addWidget(self.Num)

        self.bBox = QDialogButtonBox()
        self.bBox.addButton('Apply', QDialogButtonBox.AcceptRole)
        self.bBox.addButton('Cancel', QDialogButtonBox.RejectRole)
        self.bBox.rejected.connect(self.reject)
        self.bBox.accepted.connect(self.accept)

        gl.addWidget(self.bBox)
        o.setLayout(gl)
コード例 #2
0
    def __init__(self, parent=None):
        super(EntryDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self.play_sound = False
        self._request_name = 'ENTRY'
        self.title = 'Numerical Entry'
        self.setWindowFlags(self.windowFlags() | Qt.Tool | Qt.Dialog
                            | Qt.WindowStaysOnTopHint
                            | Qt.WindowSystemMenuHint)

        l = QVBoxLayout()
        self.setLayout(l)

        o = TouchInputWidget()
        l.addWidget(o)

        self.Num = QLineEdit()
        # actiate touch input
        self.Num.keyboard_type = 'numeric'
        self.Num.returnPressed.connect(lambda: self.accept())

        gl = QVBoxLayout()
        gl.addWidget(self.Num)

        self.bBox = QDialogButtonBox()
        self.bBox.addButton('Apply', QDialogButtonBox.AcceptRole)
        self.bBox.addButton('Cancel', QDialogButtonBox.RejectRole)
        self.bBox.rejected.connect(self.reject)
        self.bBox.accepted.connect(self.accept)

        gl.addWidget(self.bBox)
        o.setLayout(gl)
コード例 #3
0
 def buildStack(self):
     tabName = self._findMacros()
     LOG.debug("Macros Found: {}".format(tabName))
     if tabName is None:
         self._buildErrorTab()
         return
     self._buildMenuPage(tabName)
     # Add pages
     # tabname is a list of found macros
     # these macro names are also used as the base name
     # of a list of required inputs.
     # we add a label and lineedit/radiobutton for each string in each
     # of these arrays
     for i, tName in enumerate(tabName):
         # make a widget that is added to the stack
         w = TouchInputWidget()
         hbox = QtWidgets.QHBoxLayout(w)
         hbox.addStretch(1)
         vbox = QtWidgets.QVBoxLayout()
         w.setObjectName(tName)
         # add labels and edits
         # self[tName][0] is the list of name text and defaults pairs
         for n, name in enumerate(self[tName][0]):
             l = QtWidgets.QLabel(name[0])
             if name[1].lower() in('false', 'true'):
                 self['%s%d' % (tName, n)] = QtWidgets.QRadioButton()
                 if name[1].lower() == 'true':
                     self['%s%d' % (tName, n)].setChecked(True)
             else:
                 self['%s%d' % (tName, n)] = QtWidgets.QLineEdit()
                 self['%s%d' % (tName, n)].keyboard_type = 'numeric'
                 self['%s%d' % (tName, n)].setText(name[1])
             vbox.addWidget(l)
             vbox.addWidget(self['%s%d' % (tName, n)])
         #add the SVG pic layer
         svg_info = self[tName][1]
         #print self.filepath+svg_info[0], svg_info[1]
         svgpath = os.path.join(self.filepath, svg_info[0])
         self['sw%d' % i] = CustomSVG(svgpath,  int(svg_info[1]))
         hbox.addWidget(self['sw%d' % i])
         vbox.addStretch(1)
         hbox.addLayout(vbox)
         # add the widget to the stack
         self.stack.addWidget(w)
コード例 #4
0
ファイル: macro_widget.py プロジェクト: LinuxCNC/linuxcnc
 def buildStack(self):
     tabName = self._findMacros()
     LOG.debug("Macros Found: {}".format(tabName))
     if tabName is None:
         self._buildErrorTab()
         return
     self._buildMenuPage(tabName)
     # Add pages
     # tabname is a list of found macros
     # these macro names are also used as the base name
     # of a list of required inputs.
     # we add a label and lineedit/radiobutton for each string in each
     # of these arrays
     for i, tName in enumerate(tabName):
         # make a widget that is added to the stack
         w = TouchInputWidget()
         hbox = QtWidgets.QHBoxLayout(w)
         hbox.addStretch(1)
         vbox = QtWidgets.QVBoxLayout()
         w.setObjectName(tName)
         # add labels and edits
         for n, name in enumerate(self[tName][0]):
             l = QtWidgets.QLabel(name[0])
             if name[1].lower() in('false', 'true'):
                 self['%s%d' % (tName, n)] = QtWidgets.QRadioButton()
                 if name[1].lower() == 'true':
                     self['%s%d' % (tName, n)].setChecked(True)
             else:
                 self['%s%d' % (tName, n)] = QtWidgets.QLineEdit()
                 self['%s%d' % (tName, n)].keyboard_type = 'numeric'
                 self['%s%d' % (tName, n)].setText(name[1])
             vbox.addWidget(l)
             vbox.addWidget(self['%s%d' % (tName, n)])
         #add the SVG pic layer
         svg_info = self[tName][1]
         #print self.filepath+svg_info[0], svg_info[1]
         svgpath = os.path.join(self.filepath, svg_info[0])
         self['sw%d' % i] = CustomSVG(svgpath,  int(svg_info[1]))
         hbox.addWidget(self['sw%d' % i])
         vbox.addStretch(1)
         hbox.addLayout(vbox)
         # add the widget to the stack
         self.stack.addWidget(w)
コード例 #5
0
ファイル: dialog_widget.py プロジェクト: lacquer/linuxcnc
    def __init__(self, parent=None):
        super(EntryDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self.play_sound = False
        self.setWindowFlags(self.windowFlags() | Qt.Tool |
                            Qt.Dialog | Qt.WindowStaysOnTopHint |
                            Qt.WindowSystemMenuHint)

        l = QVBoxLayout()
        self.setLayout(l)

        o = TouchInputWidget()

        self.Num = QLineEdit()
        self.Num.returnPressed.connect(lambda: self.close())
        # actiate touch input
        self.Num.keyboard_type = 'numeric'
        gl = QVBoxLayout()
        gl.addWidget(self.Num)
        o.setLayout(gl)
        l.addWidget(o)
コード例 #6
0
    def __init__(self, parent=None):
        super(EntryDialog, self).__init__(parent)
        self._color = QColor(0, 0, 0, 150)
        self.play_sound = False
        self.setWindowFlags(self.windowFlags() | Qt.Tool | Qt.Dialog
                            | Qt.WindowStaysOnTopHint
                            | Qt.WindowSystemMenuHint)

        l = QVBoxLayout()
        self.setLayout(l)

        o = TouchInputWidget()

        self.Num = QLineEdit()
        self.Num.returnPressed.connect(lambda: self.close())
        # actiate touch input
        self.Num.keyboard_type = 'numeric'
        gl = QVBoxLayout()
        gl.addWidget(self.Num)
        o.setLayout(gl)
        l.addWidget(o)
コード例 #7
0
 def buildStack(self):
     macroFlag = False
     for path in INFO.SUB_PATH_LIST:
         if 'macro' in path:
             path = os.path.expanduser(path)
             tabName = self._findMacros(path)
             LOG.debug("Macros Found: {}".format(tabName))
             if tabName is None:
                 continue
             macroFlag = True
             self._buildMenuPage(tabName,path)
             # Add pages
             # tabname is a list of found macros
             # these macro names are also used as the base name
             # of a list of required inputs.
             # we add a label and lineedit/radiobutton for each string in each
             # of these arrays
             for i, tName in enumerate(tabName):
                 # make a widget that is added to the stack
                 w = TouchInputWidget()
                 hbox = QtWidgets.QHBoxLayout(w)
                 #hbox.addStretch(1)
                 vbox = QtWidgets.QVBoxLayout()
                 w.setObjectName(tName)
                 # add labels and edits
                 # self[tName][0] is the list of name text and defaults pairs
                 for n, name in enumerate(self[tName][0]):
                     # if no list of names then continue looking
                     if name[0]=='':continue
                     l = QtWidgets.QLabel(name[0])
                     if name[1].lower() in('false', 'true'):
                         self['%s%d' % (tName, n)] = QtWidgets.QRadioButton()
                         if name[1].lower() == 'true':
                             self['%s%d' % (tName, n)].setChecked(True)
                     else:
                         self['%s%d' % (tName, n)] = QtWidgets.QLineEdit()
                         self['%s%d' % (tName, n)].keyboard_type = 'numeric'
                         self['%s%d' % (tName, n)].setText(name[1])
                     vbox.addWidget(l)
                     vbox.addWidget(self['%s%d' % (tName, n)])
                 #add the SVG pic layer
                 img_info = self[tName][1]
                 #print path+svg_info[0], svg_info[1]
                 if img_info[0].endswith('.svg'):
                     svgpath = os.path.join(path, img_info[0])
                     self['sw%d' % i] = CustomSVG(svgpath,  int(img_info[1]))
                 else:
                     try:
                         print self[tName][1][1]
                         imgpath = os.path.join(path, self[tName][1][1])
                     except:
                         imgpath = os.path.join(path, img_info[0])
                     #self['sw%d' % i] = QtWidgets.QPushButton()
                     #self['sw%d' % i].setIcon(QtGui.QIcon(imgpath))
                     self['sw%d' % i] = QtWidgets.QLabel()
                     self['sw%d' % i].setPixmap(QtGui.QPixmap(imgpath))
                     self['sw%d' % i]. setScaledContents(True)
                     #self['sw%d' % i].setSizeHint(300, 300)
                     self['sw%d' % i].setSizePolicy(QtWidgets.QSizePolicy.Expanding,QtWidgets.QSizePolicy.Expanding)
                 hbox.addWidget(self['sw%d' % i])
                 vbox.addStretch(1)
                 hbox.addLayout(vbox)
                 # add the widget to the stack
                 self.stack.addWidget(w)
     # No macros found in any path
     # show a message
     if macroFlag == False:
         self._buildErrorTab()