Python PySide.QtGui 模块,QComboBox() 实例源码

我们从Python开源项目中,提取了以下46个代码示例,用于说明如何使用PySide.QtGui.QComboBox()

项目:epycyzm    作者:slush0    | 项目源码 | 文件源码
def createIconGroupBox(self):
        self.iconGroupBox = QtGui.QGroupBox("Tray Icon")

        self.iconLabel = QtGui.QLabel("Icon:")

        self.iconComboBox = QtGui.QComboBox()
        self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner")
        self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart")
        self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash")

        self.showIconCheckBox = QtGui.QCheckBox("Show icon")
        self.showIconCheckBox.setChecked(True)

        iconLayout = QtGui.QHBoxLayout()
        iconLayout.addWidget(self.iconLabel)
        iconLayout.addWidget(self.iconComboBox)
        iconLayout.addStretch()
        iconLayout.addWidget(self.showIconCheckBox)
        self.iconGroupBox.setLayout(iconLayout)
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, model):
        super(PassiveEditWidget, self).__init__()
        self.__model = model

        self.__idx_to_wk = {}
        self.__wk_to_idx = {}

        self.cb_well_known = QtGui.QComboBox()
        self.layout.addRow("Package", self.cb_well_known)

        self.__add_wk(None, "Custom")
        self.cb_well_known.insertSeparator(self.cb_well_known.maxCount())

        for v in well_known_chip:
            self.__add_wk(v)

        self.cb_well_known.currentIndexChanged.connect(self.pkg_changed)
        self.cb_well_known.setCurrentIndex(self.__wk_to_idx[self.__model.well_known])
        self.pkg_changed(self.cb_well_known.currentIndex())

        # Snap checkbox
        self.cb_snap = QtGui.QCheckBox()
        self.cb_snap.setChecked(self.__model.snap_well)
        self.layout.addRow("Snap to Well Known", self.cb_snap)

        self.gs = [
            self.addEdit("Pad Centers", UnitEditable(self.__model, "pin_d", UNIT_GROUP_MM)),
            self.addEdit("Body length", PointUnitEditable(self.__model, "body_corner_vec", "x", UNIT_GROUP_MM)),
            self.addEdit("Body width", PointUnitEditable(self.__model, "body_corner_vec", "y", UNIT_GROUP_MM)),

            self.addEdit("Pad length", PointUnitEditable(self.__model, "pin_corner_vec", "x", UNIT_GROUP_MM)),
            self.addEdit("Pad width", PointUnitEditable(self.__model, "pin_corner_vec", "y", UNIT_GROUP_MM)),
            ]
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, unitGroup, field_type=int):
        super(UnitLineEdit, self).__init__()
        self.unit_idx = 0
        self._value = 0
        self._field_type = float

        self.layout = QtGui.QHBoxLayout()
        self.layout.setContentsMargins(0,0,0,0)

        self.__lineEdit = PLineEdit()
        self.__lineEdit.editingFinished.connect(self.text_changed)

        self.__unitDropDown = QtGui.QComboBox()
        self.__unitDropDown.currentIndexChanged.connect(self.indexChanged)

        self._placeholder_value = None

        self.setLayout(self.layout)
        self.layout.addWidget(self.__lineEdit, 0)
        self.layout.addWidget(self.__unitDropDown, 1)

        self.setUnitGroup(unitGroup)
项目:FreeCAD-GDT    作者:juanvanyo    | 项目源码 | 文件源码
def generateWidget( self, idGDT, ContainerOfData ):
        self.idGDT = idGDT
        self.ContainerOfData = ContainerOfData

        if self.Text == 'Primary:':
            self.k=0
        elif self.Text == 'Secondary:':
            self.k=1
        elif self.Text == 'Tertiary:':
            self.k=2
        elif self.Text == 'Characteristic:':
            self.k=3
        elif self.Text == 'Datum system:':
            self.k=4
        elif self.Text == 'Active annotation plane:':
            self.k=5
        else:
            self.k=6

        self.ContainerOfData.combo[self.k] = QtGui.QComboBox()
        for i in range(len(self.List)):
            if self.Icons <> None:
                self.ContainerOfData.combo[self.k].addItem( QtGui.QIcon(self.Icons[i]), self.List[i] )
            else:
                if self.List[i] == None:
                    self.ContainerOfData.combo[self.k].addItem( '' )
                else:
                    self.ContainerOfData.combo[self.k].addItem( self.List[i].Label )
        if self.Text == 'Secondary:' or self.Text == 'Tertiary:':
            self.ContainerOfData.combo[self.k].setEnabled(False)
        if self.ToolTip <> None:
            self.ContainerOfData.combo[self.k].setToolTip( self.ToolTip[0] )
        self.comboIndex = self.ContainerOfData.combo[self.k].currentIndex()
        if self.k <> 0 and self.k <> 1:
            self.updateDate(self.comboIndex)
        self.ContainerOfData.combo[self.k].activated.connect(lambda comboIndex = self.comboIndex: self.updateDate(comboIndex))
        return GDTDialog_hbox(self.Text,self.ContainerOfData.combo[self.k])
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def loadCategories(self):
        for i in range(self.categoriesTable.rowCount(), 0, -1):
            self.categoriesTable.removeRow(i - 1)
        ##
        self.tabs.setTabEnabled(1, True)

        for i in self.newDtabase.getElementsByTagName('categories')[0].getElementsByTagName('category'):
            rowNumber = self.categoriesTable.rowCount()
            self.categoriesTable.insertRow(rowNumber)
            ######
            widgetActive = QtGui.QCheckBox('')
            widgetActive.setStyleSheet('margin-left:18px;')
            self.categoriesTable.setCellWidget(rowNumber, 0, widgetActive)
            #
            itemID = QtGui.QTableWidgetItem(i.getAttribute("number"))
            self.categoriesTable.setItem(rowNumber, 1, itemID)
            #
            itemName = QtGui.QTableWidgetItem(i.getAttribute("name"))
            self.categoriesTable.setItem(rowNumber, 2, itemName)
            #
            try:
                cDescription = i.firstChild.data
            except:
                cDescription = ''

            itemDescription = QtGui.QTableWidgetItem(cDescription)
            self.categoriesTable.setItem(rowNumber, 3, itemDescription)
            # new category
            widgetAction = QtGui.QComboBox()
            widgetAction.addItem('New category', [-1, ''])  # new category
            #
            nr = 1
            for j, k in readCategories().items():
                widgetAction.addItem('Move all objects to existing category: {0}'.format(k[0]), [j, k[0]])
                if k[0] == i.getAttribute("name"):
                    widgetAction.setCurrentIndex(nr)
                nr += 1
            self.categoriesTable.setCellWidget(rowNumber, 4, widgetAction)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self):
        self.dostepneWarstwy = QtGui.QComboBox()
        self.dostepneWarstwy.addItems(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
        self.dostepneWarstwy.setCurrentIndex(1)
        self.dostepneWarstwy.setMaximumWidth(60)
项目:Electrify    作者:jyapayne    | 项目源码 | 文件源码
def create_list_setting(self, name):
        hlayout = QtGui.QHBoxLayout()

        setting = self.get_setting(name)

        button = None
        if setting.button:
            button = QtGui.QPushButton(setting.button)
            button.clicked.connect(lambda: setting.button_callback(button))
        combo = QtGui.QComboBox()

        combo.setObjectName(setting.name)

        combo.currentIndexChanged.connect(self.call_with_object('setting_changed',
                                                                  combo, setting))
        combo.editTextChanged.connect(self.call_with_object('setting_changed',
                                                              combo, setting))

        combo.setStatusTip(setting.description)
        combo.setToolTip(setting.description)

        for val in setting.values:
            combo.addItem(val)

        default_index = combo.findText(setting.default_value)
        if default_index != -1:
            combo.setCurrentIndex(default_index)

        hlayout.addWidget(QtGui.QLabel())
        hlayout.addWidget(combo)
        if button:
            hlayout.addWidget(button)

        return hlayout
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def initUI(self):
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)
        self.layout.setContentsMargins(0,0,0,0)

        self.releaseTypeLabel = QtGui.QLabel("Release Type :")
        self.releaseType = QtGui.QComboBox()
        self.releaseType.addItems(["2D","3D"])
        self.releaseType.currentIndexChanged.connect(self.currentIndexChanged)

        self.layout.addWidget(self.releaseTypeLabel,1,0)
        self.layout.addWidget(self.releaseType,1,2,1,2)


        a = QtGui.QListWidget()
        b = QtGui.QListWidget()

        self.elementForm()

        self.tab = QtGui.QTabWidget()
        self.tab.addTab(self.elementFormWidget,"Element")
        self.tab.addTab(b,"Email")
        #gesw = self.generateElementSelectionWidget()
        self.layout.addWidget(self.tab,2,0,10,4)

        self.elementFormLayout.addWidget(self.backButton,11,2)
        self.elementFormLayout.addWidget(self.nextButton,11,3)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def elementForm(self):
        self.elementFormWidget = QtGui.QWidget()

        self.elementFormLayout = QtGui.QGridLayout()
        self.elementFormWidget.setLayout(self.elementFormLayout)


        self.showList=QtGui.QComboBox()
        self.sqList=QtGui.QComboBox()
        self.shotList=QtGui.QComboBox()
        self.taskList=QtGui.QComboBox()

        self.userFilterLabel = QtGui.QLabel("User Filter")
        self.userFilter = QtGui.QLineEdit(str(os.getenv("USER")))

        self.renderList = QtGui.QListWidget()
        self.renderList.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)

        self.generateList()

        self.backButton=QtGui.QPushButton("Back")
        self.nextButton=QtGui.QPushButton("Next")

        self.elementFormLayout.addWidget(self.showList,4,0)
        self.elementFormLayout.addWidget(self.sqList,4,1)
        self.elementFormLayout.addWidget(self.shotList,4,2)
        self.elementFormLayout.addWidget(self.taskList,4,3)
        self.elementFormLayout.addWidget(self.userFilterLabel,7,0)
        self.elementFormLayout.addWidget(self.userFilter,7,1,1,3)
        self.elementFormLayout.addWidget(self.renderList,6,0,1,4)
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def initUI(self):
        self.layout = QtGui.QGridLayout()
        self.setLayout(self.layout)

        self.combo = QtGui.QComboBox()
        self.combo.addItems(["Files","Stats","Custom"])
        self.combo.currentIndexChanged.connect(self.currentIndexChanged)
        self.layout.addWidget(self.combo)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setupUI(self):
        #==============================

        # main_layout for QMainWindow
        main_widget = QtGui.QWidget()
        self.setCentralWidget(main_widget)        
        main_layout = self.quickLayout('vbox') # grid for auto fill window size
        main_widget.setLayout(main_layout)
        '''
        # main_layout for QDialog
        main_layout = self.quickLayout('vbox')
        self.setLayout(main_layout)
        '''

        #------------------------------
        # ui element creation part
        info_split = self.quickSplitUI( "info_split", self.quickUI(["dict_table;QTableWidget","source_txtEdit;LNTextEdit","result_txtEdit;LNTextEdit"]), "v" )
        fileBtn_layout = self.quickUI(["filePath_input;QLineEdit", "fileLoad_btn;QPushButton;Load", "fileLang_choice;QComboBox", "fileExport_btn;QPushButton;Export"],"fileBtn_QHBoxLayout")
        self.quickUI( [info_split, "process_btn;QPushButton;Process and Update Memory From UI", fileBtn_layout], main_layout)
        self.uiList["source_txtEdit"].setWrap(0)
        self.uiList["result_txtEdit"].setWrap(0)

        '''
        self.uiList['secret_btn'] = QtGui.QPushButton(self) # invisible but functional button
        self.uiList['secret_btn'].setText("")
        self.uiList['secret_btn'].setGeometry(0, 0, 50, 20)
        self.uiList['secret_btn'].setStyleSheet("QPushButton{background-color: rgba(0, 0, 0,0);} QPushButton:pressed{background-color: rgba(0, 0, 0,0); border: 0px;} QPushButton:hover{background-color: rgba(0, 0, 0,0); border: 0px;}")
        #:hover:pressed:focus:hover:disabled
        '''
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit',
            'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def setLang(self, langName):
        lang_data = self.memoData['lang'][langName]
        for ui_name in lang_data.keys():
            if ui_name in self.uiList.keys() and lang_data[ui_name] != '':
                ui_element = self.uiList[ui_name]
                # '' means no translation availdanle in that data file
                if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):
                    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                    ui_element.setText(lang_data[ui_name])
                elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):
                    # uiType: QMenu, QGroupBox
                    ui_element.setTitle(lang_data[ui_name])
                elif isinstance(ui_element, QtWidgets.QTabWidget):
                    # uiType: QTabWidget
                    tabCnt = ui_element.count()
                    tabNameList = lang_data[ui_name].split(';')
                    if len(tabNameList) == tabCnt:
                        for i in range(tabCnt):
                            if tabNameList[i] != '':
                                ui_element.setTabText(i,tabNameList[i])
                elif isinstance(ui_element, QtWidgets.QComboBox):
                    # uiType: QComboBox
                    itemCnt = ui_element.count()
                    itemNameList = lang_data[ui_name].split(';')
                    ui_element.clear()
                    ui_element.addItems(itemNameList)
                elif isinstance(ui_element, QtWidgets.QTreeWidget):
                    # uiType: QTreeWidget
                    labelCnt = ui_element.headerItem().columnCount()
                    labelList = lang_data[ui_name].split(';')
                    ui_element.setHeaderLabels(labelList)
                elif isinstance(ui_element, QtWidgets.QTableWidget):
                    # uiType: QTableWidget
                    colCnt = ui_element.columnCount()
                    headerList = lang_data[ui_name].split(';')
                    cur_table.setHorizontalHeaderLabels( headerList )
                elif isinstance(ui_element, (str, unicode) ):
                    # uiType: string for msg
                    self.uiList[ui_name] = lang_data[ui_name]
项目:freecad-nurbs    作者:microelly2    | 项目源码 | 文件源码
def MyDialog(target=None):

    import nurbswb.sole_models
    reload(nurbswb.sole_models)
    lm=nurbswb.sole_models.listModels()

    w=QtGui.QWidget()
    w.target=target

    box = QtGui.QVBoxLayout()
    w.setLayout(box)
    w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)



    l=QtGui.QLabel("Select the model" )
    box.addWidget(l)


    combo = QtGui.QComboBox()

    for item in lm:
        combo.addItem(str(item))


    w.m=combo
    combo.activated.connect(lambda:srun(w))  

    box.addWidget(combo)


    w.show()
    return w
项目:freecad-nurbs    作者:microelly2    | 项目源码 | 文件源码
def MyLoadDialog(target=None):
    '''widget for load sketch from file into a sketch object''' 

    lm=getfiles()
    w=QtGui.QWidget()
    w.target=target

    box = QtGui.QVBoxLayout()
    w.setLayout(box)
    w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

    l=QtGui.QLabel("Select the model" )
    box.addWidget(l)

    combo = QtGui.QComboBox()
    for item in lm:
        combo.addItem(str(item))
    w.m=combo
    combo.activated.connect(lambda:srun(w))  
    box.addWidget(combo)

#   w.r=QtGui.QPushButton("save selected sketch as file")
#   box.addWidget(w.r)
#   w.r.pressed.connect(lambda :saveSketch(w))

    w.show()
    return w


# hier names dialog einbauen
项目:freecad-nurbs    作者:microelly2    | 项目源码 | 文件源码
def MyDialog(target):

    import nurbswb.needle_models
    reload(nurbswb.needle_models)
    lm=nurbswb.needle_models.listModels()

    w=QtGui.QWidget()
    w.target=target

    box = QtGui.QVBoxLayout()
    w.setLayout(box)
    w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)



    l=QtGui.QLabel("Select the model" )
    box.addWidget(l)


    combo = QtGui.QComboBox()

    for item in lm:
        combo.addItem(str(item))


    w.m=combo
    combo.activated.connect(lambda:srun(w))  

    box.addWidget(combo)


    w.show()
    return w
项目:LCInterlocking    作者:execuc    | 项目源码 | 文件源码
def create_item(self, widget_config, grid, row_index):
        widget_config.widget_title = QtGui.QLabel(self.form)
        widget_config.widget_title.setText("%s : " % widget_config.show_name)

        if widget_config.type == float and not hasattr(widget_config, 'step'):
            widget_config.widget = QtGui.QLabel(self.form)
            widget_config.widget.setText("%f" % self.get_property_value(widget_config.name))
        elif widget_config.type == float:
            widget_config.widget = QtGui.QDoubleSpinBox(self.form)
            widget_config.widget.setDecimals(widget_config.decimals)
            widget_config.widget.setSingleStep(widget_config.step)
            widget_config.widget.setMinimum(widget_config.interval_value[0])
            widget_config.widget.setValue(self.get_property_value(widget_config.name))
            widget_config.widget.setMaximum(widget_config.interval_value[-1])
        elif widget_config.type == bool:
            widget_config.widget = QtGui.QCheckBox("", self.form)
            state = QtCore.Qt.Checked if self.get_property_value(widget_config.name) == True else QtCore.Qt.Unchecked
            widget_config.widget.setCheckState(state)
        elif widget_config.type == list:
            widget_config.widget = QtGui.QComboBox(self.form)
            widget_config.widget.addItems(widget_config.interval_value)
            default_value_index = 0
            for str_value in widget_config.interval_value:
                if self.get_property_value(widget_config.name) == str_value:
                    break
                default_value_index += 1
            if default_value_index == len(widget_config.interval_value):
                raise ValueError("Default value not found for list" + widget_config.name)
            widget_config.widget.setCurrentIndex(default_value_index)
            widget_config.widget.currentIndexChanged.connect(self.listchangeIndex)
        elif widget_config.type == str:
            widget_config.widget = QtGui.QLineEdit(self.form)
            widget_config.widget.setText(self.get_property_value(widget_config.name))
        else:
            raise ValueError("Undefined widget type")

        grid.addWidget(widget_config.widget_title, row_index, 0)
        grid.addWidget(widget_config.widget, row_index, 1)
项目:LCInterlocking    作者:execuc    | 项目源码 | 文件源码
def init_tree_widget(self):
        # Add part buttons
        h_box = QtGui.QHBoxLayout(self.tree_widget)
        add_parts_button = QtGui.QPushButton('Add parts', self.tree_widget)
        add_parts_button.clicked.connect(self.add_parts)
        add_same_part_button = QtGui.QPushButton('Add same parts', self.tree_widget)
        add_same_part_button.clicked.connect(self.add_same_parts)
        h_box.addWidget(add_parts_button)
        h_box.addWidget(add_same_part_button)
        self.tree_vbox.addLayout(h_box)
        # Add faces buttons
        h_box = QtGui.QHBoxLayout(self.tree_widget)
        self.tab_type_box = QtGui.QComboBox(self.tree_widget)
        self.tab_type_box.addItems([TabProperties.TYPE_TAB, TabProperties.TYPE_T_SLOT,
                                    TabProperties.TYPE_CONTINUOUS, TabProperties.TYPE_FLEX])
        h_box.addWidget(self.tab_type_box)
        add_faces_button = QtGui.QPushButton('Add faces', self.tree_widget)
        add_faces_button.clicked.connect(self.add_tabs)
        add_same_faces_button = QtGui.QPushButton('Add same faces', self.tree_widget)
        add_same_faces_button.clicked.connect(self.add_same_tabs)
        h_box.addWidget(add_faces_button)
        h_box.addWidget(add_same_faces_button)
        self.tree_vbox.addLayout(h_box)
        # tree
        self.selection_model = self.tree_view_widget.selectionModel()
        self.selection_model.selectionChanged.connect(self.selection_changed)
        self.tree_vbox.addWidget(self.tree_view_widget)
        remove_item_button = QtGui.QPushButton('Remove item', self.tree_widget)
        remove_item_button.clicked.connect(self.remove_items)
        self.tree_vbox.addWidget(remove_item_button)
        # test layout
        self.edit_items_layout = QtGui.QVBoxLayout(self.tree_widget)
        self.tree_vbox.addLayout(self.edit_items_layout)
项目:PH5    作者:PIC-IRIS    | 项目源码 | 文件源码
def createComboBox(self, text=""):
        '''
           Create a combo box
        '''
        comboBox = QtGui.QComboBox()
        comboBox.setEditable(True)
        comboBox.addItem(text)
        comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
                               QtGui.QSizePolicy.Preferred)
        return comboBox
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, mdl, ctrl):
        super(ComponentSettings, self).__init__()

        self.mdl = mdl

        hfl = QtGui.QFormLayout()
        ct_cmb = QtGui.QComboBox()
        for _, i in sorted(mdl_meta.items(), key=lambda i: i[0]):
            ct_cmb.addItem(i.text)

        ct_cmb.setCurrentIndex(self.mdl.cmptype)

        ct_cmb.currentIndexChanged.connect(self.changeTab)

        hfl.addRow("Component Type", ct_cmb)


        self.w_x = UnitEditable(ctrl.flow, "center.x", UNIT_GROUP_MM)
        hfl.addRow("Position X:", self.w_x.widget)
        self.w_y = UnitEditable(ctrl.flow, "center.y", UNIT_GROUP_MM)
        hfl.addRow("Position Y:", self.w_y.widget)
        self.w_theta = DegreeEditable(ctrl.flow, "theta")
        hfl.addRow("Theta:", self.w_theta.widget)

        self.headerWidget.setLayout(hfl)

        for k, i in sorted(mdl_meta.items(), key=lambda i: i[0]):
            self.addAutoWidget(i.widget_cons(mdl.model_instances[k]))

        self.selectWidget(self.mdl.cmptype)

        self.ctrl = ctrl
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(186, 154)
        Form.setMaximumSize(QtCore.QSize(200, 16777215))
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 7, 0, 1, 2)
        self.linkCombo = QtGui.QComboBox(Form)
        self.linkCombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        self.linkCombo.setObjectName("linkCombo")
        self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2)
        self.autoPercentSpin = QtGui.QSpinBox(Form)
        self.autoPercentSpin.setEnabled(True)
        self.autoPercentSpin.setMinimum(1)
        self.autoPercentSpin.setMaximum(100)
        self.autoPercentSpin.setSingleStep(1)
        self.autoPercentSpin.setProperty("value", 100)
        self.autoPercentSpin.setObjectName("autoPercentSpin")
        self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2)
        self.autoRadio = QtGui.QRadioButton(Form)
        self.autoRadio.setChecked(True)
        self.autoRadio.setObjectName("autoRadio")
        self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2)
        self.manualRadio = QtGui.QRadioButton(Form)
        self.manualRadio.setObjectName("manualRadio")
        self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2)
        self.minText = QtGui.QLineEdit(Form)
        self.minText.setObjectName("minText")
        self.gridLayout.addWidget(self.minText, 1, 2, 1, 1)
        self.maxText = QtGui.QLineEdit(Form)
        self.maxText.setObjectName("maxText")
        self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1)
        self.invertCheck = QtGui.QCheckBox(Form)
        self.invertCheck.setObjectName("invertCheck")
        self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4)
        self.mouseCheck = QtGui.QCheckBox(Form)
        self.mouseCheck.setChecked(True)
        self.mouseCheck.setObjectName("mouseCheck")
        self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4)
        self.visibleOnlyCheck = QtGui.QCheckBox(Form)
        self.visibleOnlyCheck.setObjectName("visibleOnlyCheck")
        self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2)
        self.autoPanCheck = QtGui.QCheckBox(Form)
        self.autoPanCheck.setObjectName("autoPanCheck")
        self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(186, 154)
        Form.setMaximumSize(QtCore.QSize(200, 16777215))
        self.gridLayout = QtGui.QGridLayout(Form)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setSpacing(0)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtGui.QLabel(Form)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 7, 0, 1, 2)
        self.linkCombo = QtGui.QComboBox(Form)
        self.linkCombo.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
        self.linkCombo.setObjectName("linkCombo")
        self.gridLayout.addWidget(self.linkCombo, 7, 2, 1, 2)
        self.autoPercentSpin = QtGui.QSpinBox(Form)
        self.autoPercentSpin.setEnabled(True)
        self.autoPercentSpin.setMinimum(1)
        self.autoPercentSpin.setMaximum(100)
        self.autoPercentSpin.setSingleStep(1)
        self.autoPercentSpin.setProperty("value", 100)
        self.autoPercentSpin.setObjectName("autoPercentSpin")
        self.gridLayout.addWidget(self.autoPercentSpin, 2, 2, 1, 2)
        self.autoRadio = QtGui.QRadioButton(Form)
        self.autoRadio.setChecked(True)
        self.autoRadio.setObjectName("autoRadio")
        self.gridLayout.addWidget(self.autoRadio, 2, 0, 1, 2)
        self.manualRadio = QtGui.QRadioButton(Form)
        self.manualRadio.setObjectName("manualRadio")
        self.gridLayout.addWidget(self.manualRadio, 1, 0, 1, 2)
        self.minText = QtGui.QLineEdit(Form)
        self.minText.setObjectName("minText")
        self.gridLayout.addWidget(self.minText, 1, 2, 1, 1)
        self.maxText = QtGui.QLineEdit(Form)
        self.maxText.setObjectName("maxText")
        self.gridLayout.addWidget(self.maxText, 1, 3, 1, 1)
        self.invertCheck = QtGui.QCheckBox(Form)
        self.invertCheck.setObjectName("invertCheck")
        self.gridLayout.addWidget(self.invertCheck, 5, 0, 1, 4)
        self.mouseCheck = QtGui.QCheckBox(Form)
        self.mouseCheck.setChecked(True)
        self.mouseCheck.setObjectName("mouseCheck")
        self.gridLayout.addWidget(self.mouseCheck, 6, 0, 1, 4)
        self.visibleOnlyCheck = QtGui.QCheckBox(Form)
        self.visibleOnlyCheck.setObjectName("visibleOnlyCheck")
        self.gridLayout.addWidget(self.visibleOnlyCheck, 3, 2, 1, 2)
        self.autoPanCheck = QtGui.QCheckBox(Form)
        self.autoPanCheck.setObjectName("autoPanCheck")
        self.gridLayout.addWidget(self.autoPanCheck, 4, 2, 1, 2)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:KicadSolderTool    作者:pioupus    | 项目源码 | 文件源码
def __init__(self, parent, footprintlist):
        QtGui.QDialog.__init__(self, parent)
        self.owner = parent
        self.combo_param_name = QtGui.QComboBox();
        self.combo_param_name.setEditable(True)
        self.footprint_list = footprintlist
        self.list_widget = PartTreeWidget(self)
        self.list_widget.setColumnCount(4)
        self.btn_load_bom = QtGui.QPushButton("load Field from xml-BOM")
        self.gridlayout = QtGui.QGridLayout()
        self.label = QtGui.QLabel("Field name:")
        self.gridlayout.addWidget(self.label,0,0,1,0)
        self.gridlayout.addWidget(self.btn_load_bom,1,1)
        self.gridlayout.addWidget(self.combo_param_name,1,0)
        self.gridlayout.addWidget(self.list_widget,2,0,1,0)
        self.label.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Minimum)
        self.combo_param_name.setSizePolicy(QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Minimum)
        self.list_widget.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding,QtGui.QSizePolicy.MinimumExpanding)
        self.param_names = []
        settings = QtCore.QSettings("./KicadSolderTool.ini",QtCore.QSettings.IniFormat)
        size = settings.beginReadArray("param_names")
        for i in range(size):
            settings.setArrayIndex(i)
            self.param_names.append(settings.value("key"))

        settings.endArray()
        self.combo_param_name.addItems(self.param_names)
        self.combo_param_name.setCurrentIndex(int(settings.value("recent_field_name",0)))

        self.setLayout(self.gridlayout)
        for footprint in self.footprint_list:        
            if footprint['bot']:
                caption = 'bot'
            else:
                caption = 'top'
            if footprint['other_side']:
                caption += "(also other side)"
            item = QtGui.QTreeWidgetItem(caption)
            item.setText(0,footprint['ref'])
            item.setText(1,caption)
            item.setText(2,footprint['val'])
            item.setCheckState(0,QtCore.Qt.Unchecked)   

            self.list_widget.addTopLevelItem(item)
        for i in range(self.list_widget.columnCount()):
            self.list_widget.resizeColumnToContents(i);
        self.setMinimumWidth(600)
        self.show()

        self.connect(self.list_widget, QtCore.SIGNAL("itemSelectionChanged()"), self.on_select)
        self.connect(self.btn_load_bom, QtCore.SIGNAL("clicked()"), self.on_load_bom)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def open(self):
        obj = FreeCAD.ActiveDocument.Objects

        nr = 0
        for i in obj:
            if hasattr(i, "Placement"):
                #top
                a = QtGui.QTreeWidgetItem()
                a.setText(0, i.Label)
                a.setCheckState(0, QtCore.Qt.Unchecked)
                a.setData(0, QtCore.Qt.UserRole, i.Name)
                try:
                    a.setIcon(0, i.ViewObject.Icon)
                except AttributeError:
                    pass
                a.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)

                dostepneWarstwy = QtGui.QComboBox()
                dostepneWarstwy.addItems(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
                dostepneWarstwy.setCurrentIndex(1)
                dostepneWarstwy.setMaximumWidth(60)
                globals()["zm_g_%s" % nr] = dostepneWarstwy  # workaround bug from pyside

                self.form.tableTop.addTopLevelItem(a)
                self.form.tableTop.setItemWidget(a, 1, globals()["zm_g_%s" % nr])

                # bottom
                a = QtGui.QTreeWidgetItem()
                a.setText(0, i.Label)
                a.setCheckState(0, QtCore.Qt.Unchecked)
                a.setData(0, QtCore.Qt.UserRole, i.Name)
                try:
                    a.setIcon(0, i.ViewObject.Icon)
                except AttributeError:
                    pass
                a.setFlags(QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsUserCheckable)

                dostepneWarstwy = QtGui.QComboBox()
                dostepneWarstwy.addItems(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'])
                dostepneWarstwy.setCurrentIndex(1)
                dostepneWarstwy.setMaximumWidth(60)
                globals()["zm_d_%s" % nr] = dostepneWarstwy  # workaround bug from pyside

                self.form.tableBottom.addTopLevelItem(a)
                self.form.tableBottom.setItemWidget(a, 1, globals()["zm_d_%s" % nr])

                ##
                nr += 1

        self.form.tableTop.resizeColumnToContents(1)
        self.form.tableBottom.resizeColumnToContents(1)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setWindowTitle(u"Create drilling map")
        #
        # Output file format
        self.formatList = QtGui.QComboBox()
        for i, j in exportList.items():
            self.formatList.addItem(j['name'], i)

        # Output directory
        self.pathToFile = QtGui.QLineEdit('')
        self.pathToFile.setReadOnly(True)

        zmianaSciezki = QtGui.QPushButton('...')
        zmianaSciezki.setToolTip(u'Change path')
        QtCore.QObject.connect(zmianaSciezki, QtCore.SIGNAL("pressed ()"), self.zmianaSciezkiF)
        # buttons
        saveButton = QtGui.QPushButton(u"Export")
        self.connect(saveButton, QtCore.SIGNAL("clicked ()"), self, QtCore.SLOT("accept()"))

        closeButton = QtGui.QPushButton(u"Close")
        self.connect(closeButton, QtCore.SIGNAL("clicked ()"), self, QtCore.SLOT('close()'))

        packageFooter = QtGui.QHBoxLayout()
        packageFooter.addStretch(10)
        packageFooter.addWidget(saveButton)
        packageFooter.addWidget(closeButton)
        packageFooter.setContentsMargins(10, 0, 10, 10)
        # header
        icon = QtGui.QLabel('')
        icon.setPixmap(QtGui.QPixmap(":/data/img/drill-icon.png"))

        headerWidget = QtGui.QWidget()
        headerWidget.setStyleSheet("padding: 10px; border-bottom: 1px solid #dcdcdc; background-color:#FFF;")
        headerLay = QtGui.QGridLayout(headerWidget)
        headerLay.addWidget(icon, 0, 0, 1, 1)
        headerLay.setContentsMargins(0, 0, 0, 0)
        ########
        centerLay = QtGui.QGridLayout()
        centerLay.addWidget(QtGui.QLabel(u'Output file format:'), 0, 0, 1, 1)
        centerLay.addWidget(self.formatList, 0, 1, 1, 2)
        centerLay.addWidget(QtGui.QLabel(u'Output directory:'), 1, 0, 1, 1)
        centerLay.addWidget(self.pathToFile, 1, 1, 1, 1)
        centerLay.addWidget(zmianaSciezki, 1, 2, 1, 1)
        centerLay.setContentsMargins(10, 20, 10, 20)

        mainLay = QtGui.QVBoxLayout(self)
        mainLay.addWidget(headerWidget)
        mainLay.addLayout(centerLay)
        mainLay.addStretch(10)
        mainLay.addLayout(packageFooter)
        mainLay.setContentsMargins(0, 0, 0, 0)
        #
        self.formatList.setCurrentIndex(self.formatList.findData('dxf'))
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def addRow(self, rowType):
        self.insertRow(self.rowCount())
        row = self.rowCount() - 1

        b = QtGui.QCheckBox("")
        b.setToolTip(u"Active")
        self.setCellWidget(row, 0, b)

        a = QtGui.QTableWidgetItem(rowType)
        a.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
        self.setItem(row, 1, a)

        c = QtGui.QComboBox()
        c.addItems(["True", "False"])
        self.setCellWidget(row, 2, c)

        d = QtGui.QDoubleSpinBox()
        d.setSingleStep(0.1)
        d.setRange(-1000, 1000)
        d.setSuffix("mm")
        self.setCellWidget(row, 3, d)

        e = QtGui.QDoubleSpinBox()
        e.setSingleStep(0.1)
        e.setRange(-1000, 1000)
        e.setSuffix("mm")
        self.setCellWidget(row, 4, e)

        f = QtGui.QDoubleSpinBox()
        f.setSingleStep(0.1)
        f.setRange(-1000, 1000)
        f.setSuffix("mm")
        self.setCellWidget(row, 5, f)

        g = QtGui.QDoubleSpinBox()
        g.setSingleStep(0.1)
        g.setValue(1.27)
        g.setSuffix("mm")
        self.setCellWidget(row, 6, g)

        color = kolorWarstwy()
        color.setToolTip(u"Click to change color")
        self.setCellWidget(row, 7, color)

        i = QtGui.QComboBox()
        i.addItems(["bottom-left", "bottom-center", "bottom-right", "center-left", "center", "center-right", "top-left", "top-center", "top-right"])
        i.setCurrentIndex(4)
        self.setCellWidget(row, 8, i)

        #
        self.setColumnWidth(0, 25)
项目:FreeCAD-PCB    作者:marmni    | 项目源码 | 文件源码
def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        #
        self.listaBibliotek = QtGui.QComboBox()
        self.listaBibliotekInfo = QtGui.QLabel(' ')
        #
        self.positionX = QtGui.QDoubleSpinBox()
        self.positionX.setSingleStep(0.1)
        self.positionX.setRange(-1000, 1000)
        self.positionX.setSuffix(' mm')
        self.positionY = QtGui.QDoubleSpinBox()
        self.positionY.setSingleStep(0.1)
        self.positionY.setRange(-1000, 1000)
        self.positionY.setSuffix(' mm')
        self.positionZ = QtGui.QDoubleSpinBox()
        self.positionZ.setSingleStep(0.1)
        self.positionZ.setRange(-1000, 1000)
        self.positionZ.setSuffix(' mm')
        self.rotationRX = QtGui.QDoubleSpinBox()
        self.rotationRX.setSingleStep(0.1)
        self.rotationRX.setRange(-360, 360)
        self.rotationRX.setSuffix(' deg')
        self.rotationRY = QtGui.QDoubleSpinBox()
        self.rotationRY.setSingleStep(0.1)
        self.rotationRY.setRange(-360, 360)
        self.rotationRY.setSuffix(' deg')
        self.rotationRZ = QtGui.QDoubleSpinBox()
        self.rotationRZ.setSingleStep(0.1)
        self.rotationRZ.setRange(-360, 360)
        self.rotationRZ.setSuffix(' deg')
        #
        translationFrame = QtGui.QGroupBox(u'Translation:')
        translationFrameLay = QtGui.QFormLayout(translationFrame)
        translationFrameLay.addRow(QtGui.QLabel('X:'), self.positionX)
        translationFrameLay.addRow(QtGui.QLabel('Y:'), self.positionY)
        translationFrameLay.addRow(QtGui.QLabel('Z:'), self.positionZ)
        translationFrameLay.setContentsMargins(5, 5, 5, 5)
        #
        rotationFrame = QtGui.QGroupBox(u'Rotation:')
        rotationFrameLay = QtGui.QFormLayout(rotationFrame)
        rotationFrameLay.addRow(QtGui.QLabel('RX:'), self.rotationRX)
        rotationFrameLay.addRow(QtGui.QLabel('RY:'), self.rotationRY)
        rotationFrameLay.addRow(QtGui.QLabel('RZ:'), self.rotationRZ)
        rotationFrameLay.setContentsMargins(5, 5, 5, 5)
        #
        libraryFrame = QtGui.QGroupBox(u'Library:')
        libraryFrameLay = QtGui.QVBoxLayout(libraryFrame)
        libraryFrameLay.addWidget(self.listaBibliotek)
        libraryFrameLay.addWidget(self.listaBibliotekInfo)
        #
        self.resetButton = QtGui.QPushButton(u'Reset')
        self.resetButton.setMaximumWidth(60)
        #
        lay = QtGui.QGridLayout()
        lay.addWidget(libraryFrame, 0, 0, 1, 2)
        lay.addWidget(translationFrame, 1, 0, 1, 1)
        lay.addWidget(rotationFrame, 1, 1, 1, 1)
        lay.addItem(QtGui.QSpacerItem(1, 10), 2, 0, 1, 2)
        lay.addWidget(self.resetButton, 3, 1, 1, 1, QtCore.Qt.AlignRight)
        lay.setRowStretch(4, 5)
        self.setLayout(lay)
项目:zeex    作者:zbarge    | 项目源码 | 文件源码
def setupUi(self, MapGrid):
        MapGrid.setObjectName("MapGrid")
        MapGrid.resize(400, 300)
        self.gridLayout_3 = QtGui.QGridLayout(MapGrid)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.gridLayout_2 = QtGui.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.gridLayout = QtGui.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.comboBoxLeft = QtGui.QComboBox(MapGrid)
        self.comboBoxLeft.setObjectName("comboBoxLeft")
        self.gridLayout.addWidget(self.comboBoxLeft, 1, 0, 1, 1)
        self.comboBoxRight = QtGui.QComboBox(MapGrid)
        self.comboBoxRight.setObjectName("comboBoxRight")
        self.gridLayout.addWidget(self.comboBoxRight, 1, 1, 1, 1)
        self.labelLeft = QtGui.QLabel(MapGrid)
        self.labelLeft.setAlignment(QtCore.Qt.AlignCenter)
        self.labelLeft.setObjectName("labelLeft")
        self.gridLayout.addWidget(self.labelLeft, 0, 0, 1, 1)
        self.labelRight = QtGui.QLabel(MapGrid)
        self.labelRight.setAlignment(QtCore.Qt.AlignCenter)
        self.labelRight.setMargin(0)
        self.labelRight.setObjectName("labelRight")
        self.gridLayout.addWidget(self.labelRight, 0, 1, 1, 1)
        self.gridLayout_2.addLayout(self.gridLayout, 0, 0, 1, 1)
        self.btnDelete = QtGui.QPushButton(MapGrid)
        self.btnDelete.setObjectName("btnDelete")
        self.gridLayout_2.addWidget(self.btnDelete, 2, 0, 1, 1)
        self.btnAdd = QtGui.QPushButton(MapGrid)
        self.btnAdd.setObjectName("btnAdd")
        self.gridLayout_2.addWidget(self.btnAdd, 1, 0, 1, 1)
        self.tableView = QtGui.QTableView(MapGrid)
        self.tableView.setObjectName("tableView")
        self.gridLayout_2.addWidget(self.tableView, 4, 0, 1, 1)
        self.gridLayout_3.addLayout(self.gridLayout_2, 0, 0, 1, 1)
        self.btnBox = QtGui.QDialogButtonBox(MapGrid)
        self.btnBox.setOrientation(QtCore.Qt.Horizontal)
        self.btnBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
        self.btnBox.setObjectName("btnBox")
        self.gridLayout_3.addWidget(self.btnBox, 1, 0, 1, 1)

        self.retranslateUi(MapGrid)
        QtCore.QObject.connect(self.btnBox, QtCore.SIGNAL("accepted()"), MapGrid.accept)
        QtCore.QObject.connect(self.btnBox, QtCore.SIGNAL("rejected()"), MapGrid.reject)
        QtCore.QMetaObject.connectSlotsByName(MapGrid)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txtEdit': 'LNTextEdit', 'txt': 'QTextEdit',
            'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = "0.1"
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
        #------------------------------
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version="0.1"
        self.help = "How to Use:\n1. Put source info in\n2. Click Process button\n3. Check result output\n4. Save memory info into a file."

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage

        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        self.qui_user_dict = {}
        #------------------------------
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = "0.1"
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']

        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
        #------------------------------
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def qui(self, ui_list_string, parentObject_string='', opt=''):
        # pre-defined user short name syntax
        type_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem', 
        }
        # get ui_list, creation or existing ui object
        ui_list = [x.strip() for x in ui_list_string.split('|')]
        for i in range(len(ui_list)):
            if ui_list[i] in self.uiList:
                # - exisiting object
                ui_list[i] = self.uiList[ui_list[i]]
            else:
                # - string creation: 
                # get part info
                partInfo = ui_list[i].split(';',1)
                uiName = partInfo[0].split('@')[0]
                uiType = uiName.rsplit('_',1)[-1]
                if uiType in type_dict:
                    uiType = type_dict[uiType]
                # set quickUI string format
                ui_list[i] = partInfo[0]+';'+uiType
                if len(partInfo)==1:
                    # give empty button and label a place holder name
                    if uiType in ('btn', 'btnMsg', 'QPushButton','label', 'QLabel'):
                        ui_list[i] = partInfo[0]+';'+uiType + ';'+uiName 
                elif len(partInfo)==2:
                    ui_list[i]=ui_list[i]+";"+partInfo[1]
        # get parentObject or exisiting object
        parentObject = parentObject_string
        if parentObject in self.uiList:
            parentObject = self.uiList[parentObject]
        # process quickUI
        self.quickUI(ui_list, parentObject, opt)
项目:universal_tool_template.py    作者:shiningdesign    | 项目源码 | 文件源码
def __init__(self, parent=None, mode=0):
        super_class.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = "0.1"
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'

        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.location = ""
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)

        self.name = self.__class__.__name__
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)

        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {}
        #------------------------------
项目:nuke    作者:Kagarrache    | 项目源码 | 文件源码
def __init__(self):
        super(LocoWidget,self).__init__()

        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
        self.setWindowTitle('Locometry v2.1')
        self.header = QtGui.QPixmap(os.path.split(__file__)[0]+'/icons/logo.png')
        self.headerLBL = QtGui.QLabel()
        self.headerLBL.setPixmap(self.header)
        self.vLayout = QtGui.QVBoxLayout()
        self.vLayout.addWidget(self.headerLBL)


        self.typeCombo = QtGui.QComboBox()
        self.typeCombo.addItems(['Axis','Card','Sphere','Cube','Cylinder','Selected Node'])
        self.frangeLBL = QtGui.QLabel('Frame Range')
        self.firstLE = QtGui.QLineEdit()
        self.lastLE = QtGui.QLineEdit()
        self.trackBTN = QtGui.QPushButton('snap')


        self.locoDic = {}

        self.progressBar = QtGui.QProgressBar()
        self.progressBar.setMinimum(1)
        self.progressBar.setMaximum(100)
        self.progressBar.setFormat('Snapping '+self.typeCombo.currentText())

        self.progressBar.setObjectName("progressBar")

        self.layout = QtGui.QHBoxLayout()
        self.layout.addWidget(self.typeCombo)
        self.layout.addWidget(self.frangeLBL)
        self.layout.addWidget(self.firstLE)
        self.layout.addWidget(self.lastLE)
        self.layout.addWidget(self.trackBTN)


        self.vLayout.addLayout(self.layout)
        self.vLayout.addWidget(self.progressBar)
        self.progressBar.hide()

        self.setLayout(self.vLayout)
        self.locoThread = None

        self.trackBTN.clicked.connect(self.trackSelectedVertices)
项目:epycyzm    作者:slush0    | 项目源码 | 文件源码
def createMessageGroupBox(self):
        self.messageGroupBox = QtGui.QGroupBox("Balloon Message")

        typeLabel = QtGui.QLabel("Type:")

        self.typeComboBox = QtGui.QComboBox()
        self.typeComboBox.addItem("None", QtGui.QSystemTrayIcon.NoIcon)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxInformation), "Information",
                QtGui.QSystemTrayIcon.Information)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxWarning), "Warning",
                QtGui.QSystemTrayIcon.Warning)
        self.typeComboBox.addItem(self.style().standardIcon(
                QtGui.QStyle.SP_MessageBoxCritical), "Critical",
                QtGui.QSystemTrayIcon.Critical)
        self.typeComboBox.setCurrentIndex(1)

        self.durationLabel = QtGui.QLabel("Duration:")

        self.durationSpinBox = QtGui.QSpinBox()
        self.durationSpinBox.setRange(5, 60)
        self.durationSpinBox.setSuffix(" s")
        self.durationSpinBox.setValue(15)

        durationWarningLabel = QtGui.QLabel("(some systems might ignore this "
                "hint)")
        durationWarningLabel.setIndent(10)

        titleLabel = QtGui.QLabel("Title:")

        self.titleEdit = QtGui.QLineEdit("Cannot connect to network")

        bodyLabel = QtGui.QLabel("Body:")

        self.bodyEdit = QtGui.QTextEdit()
        self.bodyEdit.setPlainText("Don't believe me. Honestly, I don't have "
                "a clue.\nClick this balloon for details.")

        self.showMessageButton = QtGui.QPushButton("Show Message")
        self.showMessageButton.setDefault(True)

        messageLayout = QtGui.QGridLayout()
        messageLayout.addWidget(typeLabel, 0, 0)
        messageLayout.addWidget(self.typeComboBox, 0, 1, 1, 2)
        messageLayout.addWidget(self.durationLabel, 1, 0)
        messageLayout.addWidget(self.durationSpinBox, 1, 1)
        messageLayout.addWidget(durationWarningLabel, 1, 2, 1, 3)
        messageLayout.addWidget(titleLabel, 2, 0)
        messageLayout.addWidget(self.titleEdit, 2, 1, 1, 4)
        messageLayout.addWidget(bodyLabel, 3, 0)
        messageLayout.addWidget(self.bodyEdit, 3, 1, 2, 4)
        messageLayout.addWidget(self.showMessageButton, 5, 4)
        messageLayout.setColumnStretch(3, 1)
        messageLayout.setRowStretch(4, 1)
        self.messageGroupBox.setLayout(messageLayout)
项目:freecad-nurbs    作者:microelly2    | 项目源码 | 文件源码
def dialog(source=None):
    ''' create dialog widget'''

    w=MyWidget()
    w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)

    w.source=source
    w.imode=-1
    w.ef="no eventfilter defined"

#   mode=QtGui.QComboBox()
#   mode.addItem("move pole") #0
#   mode.addItem("move pole and neighbors") #1
#   mode.addItem("sharpen/smooth edge") #2
#   mode.addItem("colinear neighbors") #3
#   mode.addItem("rotate neighbors") #4
#
    w.mode='n'
#
    editorkey=FreeCAD.ParamGet('User parameter:Plugins/nurbs').GetString("editorKey","h")
#   lab=QtGui.QLabel("Direction: " + editorkey)
    w.key=editorkey
#   w.modelab=lab

    btn=QtGui.QPushButton("Apply and close")
    btn.clicked.connect(w.apply)

    cobtn=QtGui.QPushButton("Apply and new")
    cobtn.clicked.connect(w.applyandnew)

    cbtn=QtGui.QPushButton("Stop Dialog (preserve Aux)")
    cbtn.clicked.connect(stop)

#   poll=QtGui.QLabel("Selected  Pole:")

#   dial=QtGui.QDial() 
#   dial.setMaximum(10)
#   dial.setNotchesVisible(True)
#   dial.setValue(FreeCAD.ParamGet('User parameter:Plugins/nurbs').GetInt("Cursor",0))
#   dial.valueChanged.connect(w.setcursor2)
#   w.dial=dial


    box = QtGui.QVBoxLayout()
    w.setLayout(box)

    for ww in [btn,cobtn] :
        box.addWidget(ww)

    return w

## create the u-ribs and v-meridians for a surface
项目:porn_sieve    作者:PornSieve    | 项目源码 | 文件源码
def init_left_pane(self):
        self.left_pane = QtGui.QVBoxLayout()

        # NICHE COMBO: make dropdown menu to select a fetish
        self.niche_combo = QtGui.QComboBox(self)
        keys = sorted(self.xpaths.keys())
        for k in keys:
            self.niche_combo.addItem(k)
        self.niche_combo.setCurrentIndex(0)
        self.niche = keys[0]
        self.niche_combo.activated[str].connect(self.set_niche)
        self.left_pane.addWidget(self.niche_combo)

        # START PG AND PGS TO SCRAPE
        self.left_pane.addSpacing(50)
        self.init_page_btns()
        self.left_pane.addSpacing(25)

        # PROGRESS BAR: tracks the progress of the scraper
        self.prog = QtGui.QProgressBar(self)
        self.left_pane.addWidget(self.prog)

        # SCRAPE: begin scraping
        self.scrape_btn = QtGui.QPushButton("scrape", self)
        self.scrape_btn.clicked.connect(self.scrape)
        self.left_pane.addWidget(self.scrape_btn)
        self.left_pane.addSpacing(25)

        # LOAD URL: load a specific url, presumably for rating.
        self.load_url_box = QtGui.QLineEdit()
        self.load_url_box.setPlaceholderText("load a specific url")

        self.feedback_spin = QtGui.QSpinBox()
        self.feedback_spin.setMaximum(100)          # (ratings must be between 0 and 100)

        self.enter_btn = QtGui.QPushButton("save")  # also on bottom is the enter/save button
        self.enter_btn.clicked.connect(lambda: self.save_usr_url())

        self.load_url_extra = QtGui.QHBoxLayout()   # put feedback and enter in one row
        self.load_url_extra.addWidget(self.feedback_spin)
        self.load_url_extra.addWidget(self.enter_btn)

        self.load_url_group = QtGui.QVBoxLayout()   # group it all together
        self.load_url_group.addWidget(self.load_url_box)
        self.load_url_group.addLayout(self.load_url_extra)
        self.left_pane.addLayout(self.load_url_group)
        self.left_pane.addSpacing(25)

        # RETRAIN: manual retraining of prediction algorithm
        self.train_btn = QtGui.QPushButton("recalculate prediction model", self)
        self.train_btn.clicked.connect(self.retrain)
        self.left_pane.addWidget(self.train_btn)
        self.left_pane.addSpacing(50)

        # QUIT: make quit button
        self.quit_btn = QtGui.QPushButton("quit", self)
        self.quit_btn.clicked.connect(self.quit)
        self.left_pane.addWidget(self.quit_btn)

        self.layout.addLayout(self.left_pane)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="E:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)
项目:nukeScripts    作者:mlavoy    | 项目源码 | 文件源码
def __init__(self, parent=None):
        self.publishData={}
        self.publishItems=[]
        self.selection=[]
        self.localDrive="D:"

        QtGui.QWidget.__init__(self, parent)
        #TreeA_Buttons
        self.PublishesHLayout = QtGui.QHBoxLayout()
        self.setLayout(self.PublishesHLayout)
        self.PublishesButtonsVLayout=QtGui.QVBoxLayout()
        #ServerRendersTree
        self.publishesTree = QtGui.QTreeWidget()
        self.publishesTree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        self.publishesTree.setObjectName("publishesTree")
        item=QtGui.QTreeWidgetItem()
        item.setText(0,"Publishes:")
        item.setText(1,"serverFrames:")
        item.setText(2,"localFrames:")
        self.publishesTree.setHeaderItem(item)
        self.publishesTree.setColumnCount(3)
        self.publishesTree.resizeColumnToContents(0)
        self.publishesTree.resizeColumnToContents(1)
        self.PublishesHLayout.addWidget(self.publishesTree)
        #frame widgets
        self.renderLocation = QtGui.QComboBox()
        self.renderLocation.insertItems(0,["server","local"])
        self.PublishesButtonsVLayout.addWidget(self.renderLocation)
        self.frameNthSize=QtGui.QLineEdit()
        self.frameNthSize.setText("10")
        self.PublishesButtonsVLayout.addWidget(self.frameNthSize)
        self.frameRange=QtGui.QLineEdit()
        self.frameRange.setText("")
        self.PublishesButtonsVLayout.addWidget(self.frameRange)
        self.phoneLabel = QtGui.QLabel()
        self.phoneLabel.setText("chunkSize")
        self.phoneLabel.setBuddy(self.frameNthSize)
        self.frameNthSize.setMaximumWidth(100)
        self.frameRange.setMaximumWidth(100)
        #TreeB_Buttons
        publishesTreeBtns = [
            ["print path", self.printPaths],
            ["copy local", self.copyLocal],
            ["printDependents", self.printDependentAovs],
            ["compareFiles", self.compareFiles],
            ["copyAllNodes", self.copyAllNodes],
        ]
        for btn in publishesTreeBtns:
            pushBtn = QtGui.QPushButton()
            pushBtn.setText(btn[0])
            pushBtn.clicked.connect(btn[1])
            self.PublishesButtonsVLayout.addWidget(pushBtn)
        spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
        self.PublishesButtonsVLayout.addItem(spacerItem)
        self.PublishesHLayout.addLayout(self.PublishesButtonsVLayout)

        self.getShotgunPublishes()
        self.buildTree()
        self.renderLocation.currentIndexChanged.connect(self.switchFilepaths)
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, parent, model):
        super(KeypointAlignmentWidget, self).__init__()
        self.model = model
        self._parent = parent

        layout = QtGui.QFormLayout()
        self.setLayout(layout)

        keypoint_gb = QtGui.QGroupBox("Keypoint")
        layout.addWidget(keypoint_gb)

        edit_layout = QtGui.QFormLayout()
        keypoint_gb.setLayout(edit_layout)


        self.kpts_sel = QtGui.QComboBox()
        self.kpts_sel.setModel(self.model.combo_adapter)
        self.kpts_sel.currentIndexChanged.connect(self.kptChanged)
        edit_layout.addRow("Keypoint:", self.kpts_sel)

        self.wx = UnitLineEdit(UNIT_GROUP_MM)
        self.wy = UnitLineEdit(UNIT_GROUP_MM)
        edit_layout.addRow("World X", self.wx)
        edit_layout.addRow("World Y", self.wy)
        self.wx.edited.connect(self.update_world)
        self.wy.edited.connect(self.update_world)

        self.px = UnitLineEdit(UNIT_GROUP_PX)
        self.py = UnitLineEdit(UNIT_GROUP_PX)
        edit_layout.addRow("Image X", self.px)
        edit_layout.addRow("Image Y", self.py)
        self.px.edited.connect(self.update_layer)
        self.py.edited.connect(self.update_layer)


        self.use_for_alignment = QtGui.QCheckBox()
        edit_layout.addRow("Use", self.use_for_alignment)
        self.use_for_alignment.clicked.connect(self.update_used)

        self.add_btn = QtGui.QPushButton("Add New")
        self.add_btn.clicked.connect(self.addKeypoint)
        self.del_btn = QtGui.QPushButton("Remove Current")
        self.del_btn.clicked.connect(self.delKeypoint)
        bhl = QtGui.QHBoxLayout()
        bhl.addWidget(self.add_btn)
        bhl.addWidget(self.del_btn)
        edit_layout.addRow(bhl)


        self.constraint_status_lbl = QtGui.QLabel("")
        self.constraint_status_lbl.setWordWrap(True)
        layout.addRow(self.constraint_status_lbl)

        self.model.changed.connect(self.modelChanged)
        self.modelChanged()
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, icmdl):
        super(BasicSMDICEditWidget, self).__init__()

        self.mdl = icmdl
        # Symmetry
        self.symw = QtGui.QComboBox()
        syms = [SYM_4_SQUARE, SYM_4_RECT, SYM_2, SYM_ARB]
        for s in syms:
            self.symw.addItem(text_for_sym(s), s)

        self.sym = guess_sym(self.mdl.side1_pins, self.mdl.side2_pins, self.mdl.side3_pins, self.mdl.side4_pins)
        self.symw.setCurrentIndex(self.sym)

        self.layout.addRow("Symmetry", self.symw)
        self.symw.currentIndexChanged.connect(self.sym_changed)

        # PinCount
        self.pin_count = 0
        self.pincw = self.addEdit("Pin Count", LineEditable(self, "pin_count", IntTrait))
        self.pincw.widget.editingFinished.connect(lambda: self.sym_value_changed(True))

        self.s1pw = self.addEdit("Side 1 Pins", LineEditable(self.mdl, "side1_pins", IntTrait))
        self.s1pw.widget.editingFinished.connect(lambda: self.sym_value_changed(False))
        self.s2pw = self.addEdit("Side 2 Pins", LineEditable(self.mdl, "side2_pins", IntTrait))
        self.s2pw.widget.editingFinished.connect(lambda: self.sym_value_changed(False))
        self.s3pw = self.addEdit("Side 3 Pins", LineEditable(self.mdl, "side3_pins", IntTrait))
        self.s3pw.widget.editingFinished.connect(lambda: self.sym_value_changed(False))
        self.s4pw = self.addEdit("Side 4 Pins", LineEditable(self.mdl, "side4_pins", IntTrait))
        self.s4pw.widget.editingFinished.connect(lambda: self.sym_value_changed(False))

        self.addEdit("(D1) Dimension 1 Body", UnitEditable(self.mdl, "dim_1_body", UNIT_GROUP_MM))
        self.addEdit("(D) Dimension 1 Pin Center-to-Center", UnitEditable(self.mdl, "dim_1_pincenter", UNIT_GROUP_MM))
        self.addEdit("(E1) Dimension 2 Body", UnitEditable(self.mdl, "dim_2_body", UNIT_GROUP_MM))
        self.addEdit("(E) Dimension 2 Pin Center-to-Center", UnitEditable(self.mdl, "dim_2_pincenter", UNIT_GROUP_MM))

        self.layout.addWidget(QtGui.QLabel("Dimension 1 is along pin 1 edge"))

        self.addEdit("(e) Pin Spacing", UnitEditable(self.mdl, "pin_spacing", UNIT_GROUP_MM))
        self.addEdit("(L) Pin PCB contact length", UnitEditable(self.mdl, "pin_contact_length", UNIT_GROUP_MM))
        self.addEdit("(b) Pin PCB contact width", UnitEditable(self.mdl, "pin_contact_width", UNIT_GROUP_MM))

        self.update_sym_ena()
        self.sym_value_changed(False)