Beispiel #1
0
    def __init__(self):

        QWidget.__init__(self)
        layout = QVBoxLayout(self)

        label = QLabel()
        listWidget = QListWidget()
        listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        hLayout = QHBoxLayout()
        buttonLoad = QPushButton("LOAD")
        buttonRemove = QPushButton("REMOVE")
        hLayout.addWidget(buttonLoad)
        hLayout.addWidget(buttonRemove)

        layout.addWidget(label)
        layout.addWidget(listWidget)
        layout.addLayout(hLayout)

        self.label = label
        self.listWidget = listWidget
        self.buttonLoad = buttonLoad
        self.buttonRemove = buttonRemove

        QtCore.QObject.connect(self.buttonLoad, QtCore.SIGNAL('clicked()'),
                               self.loadCommand)
        QtCore.QObject.connect(self.buttonRemove, QtCore.SIGNAL('clicked()'),
                               self.removeCommand)
Beispiel #2
0
 def __init__(self ):
     
     QWidget.__init__( self )
     layout = QVBoxLayout( self )
     
     label = QLabel()
     listWidget = QListWidget()
     listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection )
     hLayout = QHBoxLayout()
     buttonLoad   = QPushButton( "LOAD")
     buttonRemove = QPushButton( "REMOVE")
     hLayout.addWidget( buttonLoad )
     hLayout.addWidget( buttonRemove )
     
     layout.addWidget( label )
     layout.addWidget( listWidget )
     layout.addLayout( hLayout )
     
     self.label = label
     self.listWidget = listWidget
     self.buttonLoad = buttonLoad
     self.buttonRemove = buttonRemove
     
     QtCore.QObject.connect( self.buttonLoad, QtCore.SIGNAL( 'clicked()' ), self.loadCommand )
     QtCore.QObject.connect( self.buttonRemove, QtCore.SIGNAL( 'clicked()' ), self.removeCommand )
Beispiel #3
0
    def addThreadList(self, threads):

        if not self.groupBoxThreadInfo:
            self.groupBoxThreadInfo = QGroupBox()
            self.threadInfo = QLabel("Thread Info.")
            self.groupBoxThreadInfo.setStyleSheet(
                "QGroupBox {border: 1px solid gray; border-radius: 9px; margin-top: 0.5em} QGroupBox::title {subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;"
            )

        if not self.threadvbox:
            self.threadvbox = QVBoxLayout()

        if not self.listThread:
            self.listThread = QListWidget()

        self.listThread.setFixedWidth(200)
        self.listThread.setSelectionMode(
            QtGui.QAbstractItemView.MultiSelection)
        QtCore.QObject.connect(self.listThread,
                               QtCore.SIGNAL("itemClicked(QListWidgetItem *)"),
                               self.toggleThreadDisplay)
        self.threadvbox.addWidget(self.threadInfo)
        self.threadvbox.addWidget(self.listThread)
        self.groupBoxThreadInfo.setLayout(self.threadvbox)
        self.addWidget(self.groupBoxThreadInfo)
        self.groupBoxThreadInfo.setSizePolicy(self.sizePolicy)

        for id in threads:
            item = QtGui.QListWidgetItem(id)
            self.listThread.addItem(item)
    def __createContents(self):
        self.contentsWidget = QListWidget()
        self.contentsWidget.setViewMode(QListView.ListMode)
        self.contentsWidget.setMovement(QListView.Static)

        toolBar = QListWidgetItem(self.contentsWidget)
        toolBar.setText(self.tr("Toolbar"))
        toolBar.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        worksheet = QListWidgetItem(self.contentsWidget)
        worksheet.setText(self.tr("Worksheet"))
        worksheet.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        computation = QListWidgetItem(self.contentsWidget)
        computation.setText(self.tr("Computation"))
        computation.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        currentItem = QSettings().value("preferences/currentitem",
                                        self.tr(QtReduceDefaults.CURRENTITEM))
        if currentItem == self.tr("Toolbar"):
            self.contentsWidget.setCurrentItem(toolBar)
        elif currentItem == self.tr("Worksheet"):
            self.contentsWidget.setCurrentItem(worksheet)
        elif currentItem == self.tr("Computation"):
            self.contentsWidget.setCurrentItem(computation)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
    def __init__(self, *args, **kwargs):
        super(Widget_listMeshs, self).__init__(*args, **kwargs)

        mainLayout = QVBoxLayout(self)
        listWidget = QListWidget()
        button = QPushButton("Refresh")
        w_buttons = QWidget()
        lay_buttons = QHBoxLayout(w_buttons)
        lay_buttons.setContentsMargins(0, 0, 0, 0)
        buttonSelect = QPushButton("Select One Meterial Face Shaded Objects")
        buttonClear = QPushButton("Clear")
        lay_buttons.addWidget(buttonSelect)
        lay_buttons.addWidget(buttonClear)
        mainLayout.addWidget(listWidget)
        mainLayout.addWidget(w_buttons)
        mainLayout.addWidget(button)
        listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.listWidget = listWidget
        self.load()
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.load)
        QtCore.QObject.connect(buttonSelect, QtCore.SIGNAL("clicked()"),
                               self.selectOneMeterialFaceShadedObjects)
        QtCore.QObject.connect(buttonClear, QtCore.SIGNAL("clicked()"),
                               self.cmd_clear)
        QtCore.QObject.connect(listWidget,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.selectItems)

        self.currentIndex = 0
Beispiel #6
0
    def _set_items(self, list_text, pic_path):
        """
        set the layout of listwidget
        :param list_text: list contains [title, subtitle]
        :param pic_path: string or list of strings
        """
        print list_text
        self.list_widget = QListWidget()
        ly_vbox = QVBoxLayout()
        if type(pic_path) is not list:
            for item in list_text:
                self._setItem(item[0], item[1], pic_path)
        else:
            for i in range(len(list_text)):
                self._setItem(list_text[i][0], list_text[i][1], pic_path[i])
        ly_vbox.addWidget(self.list_widget)
        self.list_widget.itemDoubleClicked.connect(self.item_doubleclick_slot)
        self.setLayout(ly_vbox)
        self.resize(300, 400)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |QDialogButtonBox.Cancel)
        ly_vbox.addWidget(buttonBox)
        buttonBox.accepted.connect(self.check_test)
        buttonBox.rejected.connect(self.reject)
        self.check_test()
Beispiel #7
0
 def addTab(self, label ):
     
     layoutWidget = QWidget()
     vLayout = QVBoxLayout(layoutWidget)
     vLayout.setContentsMargins(5,5,5,5)
     
     setFolderLayout = QHBoxLayout()
     listWidget = QListWidget()
     listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection )
     vLayout.addLayout( setFolderLayout )
     vLayout.addWidget( listWidget )
     
     lineEdit = QLineEdit()
     setFolderButton = QPushButton( 'Set Folder' )
     
     setFolderLayout.addWidget( lineEdit )
     setFolderLayout.addWidget( setFolderButton )
     
     QtCore.QObject.connect( setFolderButton, QtCore.SIGNAL( 'clicked()' ),  Functions.setFolder )
     QtCore.QObject.connect( listWidget, QtCore.SIGNAL( 'itemSelectionChanged()' ),  Functions.loadImagePathArea )
     QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged()' ), Functions.lineEdited )
     
     listWidget.setObjectName( Window_global.listWidgetObjectName )
     lineEdit.setContextMenuPolicy( QtCore.Qt.NoContextMenu )
     lineEdit.setObjectName( Window_global.lineEditObjectName )
     
     lineEdit.returnPressed.connect( Functions.lineEdited )
     
     super( Tab, self ).addTab( layoutWidget, label )
Beispiel #8
0
class TestWindow(QMainWindow):
    
    
    def __init__(self):
        
        super(TestWindow, self).__init__()
        
        self.setWindowTitle('PySide QListWidget Problem')
        
        self._list = QListWidget(self)
        self._list.insertItems(0, [str(i + 1) for i in xrange(50)])
        
        # This line seems to be the problem. Change "Contiguous" to "Single"
        # and item deletion does not cause the list to scroll to the top.
        self._list.setSelectionMode(QAbstractItemView.ContiguousSelection)
        
        button = QPushButton('Delete', self)
        button.clicked.connect(self._on_button_clicked)
        
        box = QVBoxLayout()
        box.addWidget(self._list)
        box.addWidget(button)
        
        widget = QWidget()
        widget.setLayout(box)
        
        self.setCentralWidget(widget)


    def _on_button_clicked(self):
        l = self._list
        for item in l.selectedItems():
            l.takeItem(l.row(item))
    def initUI(self):
        mainlay = QVBoxLayout()
        mainlay.addWidget(QLabel('<b>Deformers ({0})</b>'.format(len(self.mdl.deformers))))

        def_list = QListWidget()
        for index, el in enumerate(self.mdl.deformers):
            def_list.addItem('{0} - {1}'.format(index, el))
        #def_list.addItems(self.mdl.deformers)
        mainlay.addWidget(def_list)

        self.def_list = def_list

        btns = QHBoxLayout()
        btns.addStretch()

        save = QPushButton('Save')
        save.clicked.connect(self.save)
        close = QPushButton('Close')
        close.clicked.connect(self.close)

        btns.addWidget(save)
        btns.addWidget(close)

        mainlay.addLayout(btns)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 200, 400)
        self.setWindowTitle('MSH Suite - {0} Deformers'.format(self.mdl.name))
        self.show()
Beispiel #10
0
    def __init__(self, *args, **kwrgs):

        existing_widgets = Window.mayaWin.findChildren(QDialog,
                                                       Window.objectName)
        if existing_widgets: map(lambda x: x.deleteLater(), existing_widgets)

        super(Window, self).__init__(*args, **kwrgs)
        self.installEventFilter(self)
        self.setObjectName(Window.objectName)
        self.setWindowTitle(Window.title)

        mainLayout = QVBoxLayout(self)
        w_rendererSelect = Widget_chooseRenderer()
        w_resolusion = Widget_resolusion()
        optimizer = QFrame()
        optimizer.setFrameShape(QFrame.HLine)
        button_sep = QPushButton("SEPARATE")
        listWidget = QListWidget()
        listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        button_convert = QPushButton("CONVERT TO LAMBERT")
        button_convert.setEnabled(False)

        mainLayout.addWidget(w_rendererSelect)
        mainLayout.addWidget(w_resolusion)
        mainLayout.addWidget(button_sep)
        mainLayout.addWidget(listWidget)
        mainLayout.addWidget(button_convert)

        self.resize(Window.defaultWidth, Window.defaultHeight)
        self.load_shapeInfo(Window.path_uiInfo)

        self.w_rendererSelect = w_rendererSelect
        self.w_resolusion = w_resolusion
        self.listWidget = listWidget
        self.button_convert = button_convert

        QtCore.QObject.connect(button_sep, QtCore.SIGNAL("clicked()"),
                               self.separate)
        QtCore.QObject.connect(button_convert, QtCore.SIGNAL("clicked()"),
                               self.convert)
        QtCore.QObject.connect(listWidget,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.selectShader)

        try:
            Cmds_mainCommands.get_csv_form_google_spreadsheets(
                Window.shaderAttr_url, Window.shaderAttr_csv)
        except:
            pass
        self.dict_shaderAttr = Cmds_mainCommands.get_dictdata_from_csvPath(
            Window.shaderAttr_csv)
        try:
            Cmds_mainCommands.get_csv_form_google_spreadsheets(
                Window.removeTarget_url, Window.removeTarget_csv)
        except:
            pass
        self.dict_removeTargets = Cmds_mainCommands.get_dictdata_from_csvPath(
            Window.removeTarget_csv)
    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(
            self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(
            self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(
            self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(
            self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(
            self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(
            self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(
            self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(
            self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
    def initUI(self):
        grp = QGroupBox('Anim Munge')
        grplay = QGridLayout()
        self.bf1mode = QCheckBox()
        grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
        grplay.addWidget(self.bf1mode, 0, 2)
        grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
        grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
        self.infiles = QListWidget()
        self.infiles.setMinimumWidth(150)
        self.infiles.addItems([os.path.basename(item) for item in self.files])
        grplay.addWidget(self.infiles, 2, 1, 1, 2)
        self.outfiles = QListWidget()
        self.outfiles.setMinimumWidth(150)
        grplay.addWidget(self.outfiles, 2, 3, 1, 2)
        self.add_params = QLineEdit()
        self.add_params.setText('Additional Params')
        self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
        grplay.addWidget(self.add_params, 0, 3, 1, 2)

        self.statlabel = QLabel('<b>AnimMunger</b>')
        grplay.addWidget(self.statlabel, 4, 1, 1, 1)
        self.animname = QLineEdit()
        self.animname.setText('AnimName')
        self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
        grplay.addWidget(self.animname, 3, 1)
        self.type_box = QComboBox()
        self.type_box.addItems(self.types)
        self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
        grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
        grplay.addWidget(self.type_box, 3, 3, 1, 2)
        munge_btn = QPushButton('Munge')
        munge_btn.clicked.connect(self.munge)
        munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
        grplay.addWidget(munge_btn, 4, 2)
        save_out = QPushButton('Save')
        save_out.clicked.connect(self.save)
        save_out.setToolTip('<b>Save.</b> Saves the output files.')
        grplay.addWidget(save_out, 4, 3)
        cancel_btn = QPushButton('Cancel')
        cancel_btn.clicked.connect(self.cancel)
        cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
        grplay.addWidget(cancel_btn, 4, 4)

        grp.setLayout(grplay)

        mainlay = QVBoxLayout()
        mainlay.addWidget(grp)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 320, 300)
        self.setWindowTitle('MSH Suite - Animation Munge')
        self.show()
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_SubscriberDialog()
        self.ui.setupUi(self)

        self.subscriber = None
        self.tableWidget = None
        self.listWidget = None

        if USE_MAEMO_5:
            switchButton = self.ui.buttonBox.addButton(
                self.tr('Switch'), QDialogButtonBox.ActionRole)
            switchButton.clicked.connect(self.switchRequested)

            self.tableWidget = self.ui.tableWidget
            headerLabels = ('Key', 'Value', 'Type')
            self.tableWidget.setColumnCount(3)
            self.tableWidget.setHorizontalHeaderLabels(headerLabels)
            horizontalHeader = self.tableWidget.horizontalHeader()
            horizontalHeader.setStretchLastSection(True)
            verticalHeader = self.tableWidget.verticalHeader()
            verticalHeader.setVisible(False)
            self.tableWidget.setColumnWidth(0, 200)
            self.tableWidget.setColumnWidth(1, 400)
        else:
            desktopWidget = QDesktopWidget()
            if desktopWidget.availableGeometry().width() < 400:
                # Screen is too small to fit a table widget without scrolling, use a list widget instead.
                self.listWidget = QListWidget()
                self.listWidget.setAlternatingRowColors(True)
                self.ui.verticalLayout.insertWidget(2, self.listWidget)
            else:
                self.tableWidget = QTableWidget()
                headerLabels = ('Key', 'Value', 'Type')
                self.tableWidget.setColumnCount(3)
                self.tableWidget.setHorizontalHeaderLabels(headerLabels)
                horizontalHeader = self.tableWidget.horizontalHeader()
                horizontalHeader.setStretchLastSection(True)
                self.tableWidget.verticalHeader()
                self.setVisible(False)
                self.ui.verticalLayout.insertWidget(2, self.tableWidget)

        self.ui.connectButton.clicked.connect(self.changeSubscriberPath)
        self.changeSubscriberPath()

        # if the default path does not exist reset it to /
        value = self.subscriber.value()
        subPaths = self.subscriber.subPaths()
        if not value and not subPaths:
            self.ui.basePath.setText('/')
            self.changeSubscriberPath()
Beispiel #14
0
 def createWidgets(self):
     self.listWidget = QListWidget()
     for row, (gid, name) in enumerate(self.state.model.normalGroups()):
         item = QListWidgetItem(name)
         item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable |
                       Qt.ItemIsEnabled)
         item.setBackground(self.palette().base() if row % 2 else
                            self.palette().alternateBase())
         item.setCheckState(Qt.Unchecked)
         item.setData(Qt.UserRole, gid)
         item.setIcon(QIcon(":/groups.svg"))
         self.listWidget.addItem(item)
     self.tooltips.append((self.listWidget, "List of Normal Groups"))
     self.buttons = QDialogButtonBox(QDialogButtonBox.Ok |
                                     QDialogButtonBox.Cancel)
Beispiel #15
0
    def createWidgets(self):
        self.listWidget = QListWidget()
        self.buttonLayout = QVBoxLayout()
        self.linkButton = None
        for icon, text, slot, tip in ((":/add.svg", "&Add", self.add, """\
<p><b>Add</b> (Alt+A)</p><p>Add a new Normal Group.</p>"""), (":/edit.svg",
                                                              "&Rename",
                                                              self.rename, """\
<p><b>Rename</b> (Alt+R)</p><p>Rename the current Group.</p>"""),
                                      (":/grouplink.svg", "&Link", self.link,
                                       """\
<p><b>Link</b> (Alt+L)</p><p>Change the current group into a Linked
Group.</p>
<p>This means that the pages of every entry in this group will be merged
and synchronized, and any future changes to the pages of any entries in
this group will be propagated to all the other entries in this
group to keep them all synchronized.</p>"""), (":/groups.svg", "&Unlink",
                                               self.unlink, """\
<p><b>Unlink</b> (Alt+U)</p><p>Change the current group into a Normal
(unlinked) Group. If the linked group
has entries, the <b>Delete Linked Group</b> dialog will pop up.</p>"""),
                                      (":/groupset.svg", "&View",
                                       self.viewGroup, """\
<p><b>View</b> (Alt+V)</p><p>View the current group in the Filtered
View.</p>"""), (":/delete.svg", "&Delete", self.delete, """\
<p><b>Delete</b> (Alt+D)</p><p>Remove entries from the current normal group
and then delete the group. If the current group is a linked group that
has entries, the <b>Delete Linked Group</b> dialog will pop up.</p>"""),
                                      (":/help.svg", "Help", self.help, """\
Help on the Groups dialog"""), (":/dialog-close.svg", "&Close", self.accept,
                                """\
<p><b>Close</b></p><p>Close the dialog.</p>""")):
            button = QPushButton(QIcon(icon), text)
            button.setFocusPolicy(Qt.NoFocus)
            if text in {"&Close", "Help"}:
                self.buttonLayout.addStretch()
            else:
                self.buttons.append(button)
            self.buttonLayout.addWidget(button)
            button.clicked.connect(slot)
            self.tooltips.append((button, tip))
            if text == "&Link":
                self.linkButton = button
                button.setEnabled(False)
            elif text == "&Unlink":
                self.unlinkButton = button
                button.setEnabled(False)
        self.tooltips.append((self.listWidget, "List of Groups"))
Beispiel #16
0
    def initWidgets(self):
        self.showAllServicesItem = QListWidgetItem(self.tr("(All registered services)"))
        self.servicesListWidget = QListWidget()
        self.interfacesListWidget = QListWidget()
        self.interfacesListWidget.addItem(self.tr("(Select a service)"))
        self.attributesListWidget = QListWidget()
        self.attributesListWidget.addItem(self.tr("(Select an interface implementation)"))
        self.interfacesListWidget.setMinimumWidth(450)
        self.servicesListWidget.currentItemChanged.connect(self.reloadInterfaceImplementationsList)
        self.interfacesListWidget.currentItemChanged.connect(self.currentInterfaceImplChanged)
        self.defaultInterfaceButton = QPushButton(self.tr("Set as default implementation"))
        self.defaultInterfaceButton.setEnabled(False)
        self.defaultInterfaceButton.clicked.connect(self.setDefaultInterfaceImplementation)
        self.selectedImplRadioButton = QRadioButton(self.tr("Selected interface implementation"))
        self.defaultImplRadioButton = QRadioButton(self.tr("Default implementation"))
        self.selectedImplRadioButton.setChecked(True)
        self.radioButtons = QButtonGroup(self)
        self.radioButtons.addButton(self.selectedImplRadioButton)
        self.radioButtons.addButton(self.defaultImplRadioButton)
        self.radioButtons.buttonClicked.connect(self.reloadAttributesList)

        self.servicesGroup = QGroupBox(self.tr("Show services for:"))
        servicesLayout = QVBoxLayout()
        servicesLayout.addWidget(self.servicesListWidget)
        self.servicesGroup.setLayout(servicesLayout)

        self.interfacesGroup = QGroupBox(self.tr("Interface implementations"))
        interfacesLayout = QVBoxLayout()
        interfacesLayout.addWidget(self.interfacesListWidget)
        interfacesLayout.addWidget(self.defaultInterfaceButton)
        self.interfacesGroup.setLayout(interfacesLayout)

        self.attributesGroup = QGroupBox(self.tr("Invokable attributes"))
        attributesLayout = QVBoxLayout()
        self.attributesGroup.setLayout(attributesLayout)
        attributesLayout.addWidget(self.attributesListWidget)
        attributesLayout.addWidget(QLabel(self.tr("Show attributes for:")))
        attributesLayout.addWidget(self.selectedImplRadioButton)
        attributesLayout.addWidget(self.defaultImplRadioButton)

        self.attributesGroup.setLayout(attributesLayout)

        layout = QGridLayout()
        layout.addWidget(self.servicesGroup, 0, 0)
        layout.addWidget(self.attributesGroup, 0, 1, 2, 1)
        layout.addWidget(self.interfacesGroup, 1, 0)

        self.setLayout(layout)
Beispiel #17
0
 def __init__(self, title, *args, **kwargs ):
     
     QWidget.__init__( self, *args )
     
     self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title
     sgCmds.makeFile( self.infoPath )
     
     layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0)
     
     groupBox = QGroupBox( title )
     layout.addWidget( groupBox )
     
     baseLayout = QVBoxLayout()
     groupBox.setLayout( baseLayout )
     
     listWidget = QListWidget()
     
     hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 )
     b_addSelected = QPushButton( "Add Selected" )
     b_clear = QPushButton( "Clear" )
     
     hl_buttons.addWidget( b_addSelected )
     hl_buttons.addWidget( b_clear )
     
     baseLayout.addWidget( listWidget )
     baseLayout.addLayout( hl_buttons )
     
     self.listWidget = listWidget
     
     QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem )
     QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected )
     QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected )
     
     self.otherWidget = None        
     self.loadInfo()
Beispiel #18
0
    def addThreadList(self,threads):

        if not self.groupBoxThreadInfo:
            self.groupBoxThreadInfo = QGroupBox()
            self.threadInfo = QLabel("Thread Info.")
            self.groupBoxThreadInfo.setStyleSheet("QGroupBox {border: 1px solid gray; border-radius: 9px; margin-top: 0.5em} QGroupBox::title {subcontrol-origin: margin; left: 10px; padding: 0 3px 0 3px;")

        if not self.threadvbox:
            self.threadvbox = QVBoxLayout()

        if not self.listThread:
            self.listThread = QListWidget()
            
        self.listThread.setFixedWidth(200)
        self.listThread.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
        QtCore.QObject.connect(self.listThread, QtCore.SIGNAL("itemClicked(QListWidgetItem *)"), self.toggleThreadDisplay)
        self.threadvbox.addWidget(self.threadInfo)
        self.threadvbox.addWidget(self.listThread)
        self.groupBoxThreadInfo.setLayout(self.threadvbox)
        self.addWidget(self.groupBoxThreadInfo)
        self.groupBoxThreadInfo.setSizePolicy(self.sizePolicy)

        for id in threads:
            item = QtGui.QListWidgetItem(id)
            self.listThread.addItem(item)
Beispiel #19
0
    def _init_load_options_tab(self, tab):

        # auto load libs

        auto_load_libs = QCheckBox(self)
        auto_load_libs.setText("Automatically load all libraries")
        auto_load_libs.setChecked(False)
        self.option_widgets['auto_load_libs'] = auto_load_libs

        # dependencies list

        dep_group = QGroupBox("Dependencies")
        dep_list = QListWidget(self)
        self.option_widgets['dep_list'] = dep_list

        sublayout = QVBoxLayout()
        sublayout.addWidget(dep_list)
        dep_group.setLayout(sublayout)

        layout = QVBoxLayout()
        layout.addWidget(auto_load_libs)
        layout.addWidget(dep_group)
        layout.addStretch(0)

        frame = QFrame(self)
        frame.setLayout(layout)
        tab.addTab(frame, "Loading Options")
Beispiel #20
0
class Console():
    def __init__(self, targetLayoutContainer):
        self.textarea = QTextEdit()
        self.commits = QListWidget()
        
        self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
        self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
        
        self.widget = QTabWidget()
        self.widget.addTab(self.textarea, 'Log')
        self.widget.addTab(self.commits, 'Commits')
        
        targetLayoutContainer.addWidget(self.widget)
        
    def color(self, module, function, color,  *args):
        print module, function, args
        
        prettyString = '<font color="' + color + '"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))    
        
    def info(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="black"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def error(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="red"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def warn(self, module, function, *args):
        print module, function, args
        
        prettyString = '<font color="#BE9900"><b>', module, '</b><i>::', function, '</i> --> ', ''.join(args), '</font>'
        self.textarea.append(''.join(prettyString))
        
    def set_commits(self, commits):
        self.commits.clear()
        
        for commit in commits:
            self.commits.addItem(commit)
            
    def clear(self):
        self.textarea.clear()
        
    def rollback(self):
        targetCommit = self.commits.currentItem().text().split(' ')[0]
        if QMessageBox.warning(None, 'Rollback to commit?', 'All commits after ' + targetCommit + ' will be lost, proceed?', QMessageBox.Yes, QMessageBox.No) == QMessageBox.Yes:
            rollback(targetCommit)
Beispiel #21
0
    def createWidgets(self):
        self.label = QLabel("Gro&ups")
        self.groupsList = QListWidget()
        self.tooltips.append((self.groupsList, """
<p><b>Groups</b> (Alt+U)</p>
<p>A (possibly empty) list of the current entry's groups.</p>"""))
        self.label.setBuddy(self.groupsList)
        self.closeButton = QToolButton()
        self.closeButton.setIcon(QIcon(":/hide.svg"))
        self.closeButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append((self.closeButton, """<p><b>Hide</b></p>
<p>Hide the Groups panel.</p>
<p>Use <b>Spelling→Show Suggestions and Groups</b> to show it
again.</p>"""))
        self.helpButton = QToolButton()
        self.helpButton.setIcon(QIcon(":/help.svg"))
        self.helpButton.setFocusPolicy(Qt.NoFocus)
        self.tooltips.append((self.helpButton, "Help on the Groups panel."))
Beispiel #22
0
    def __init__(self):
        generic.GenericGui.__init__(self)
        window = QWidget()
        window.setWindowTitle('quichem-pyside')

        self.compiler_view = QListWidget()
        self.compiler_view.currentRowChanged.connect(self.show_source)
        self.stacked_widget = QStackedWidget()
        self.stacked_widget.setFrameStyle(QFrame.StyledPanel | QFrame.Raised)
        self.edit = QLineEdit()
        self.edit.setPlaceholderText('Type quichem input...')
        self.edit.textChanged.connect(self.change_value)
        self.view = QWebView()
        self.view.page().mainFrame().setScrollBarPolicy(Qt.Vertical,
                                                        Qt.ScrollBarAlwaysOff)
        self.view.page().action(QWebPage.Reload).setVisible(False)
        self.view.setMaximumHeight(0)
        self.view.setUrl('qrc:/web/page.html')
        self.view.setZoomFactor(2)
        self.view.page().mainFrame().contentsSizeChanged.connect(
            self._resize_view)
        # For debugging JS:
        ## from PySide.QtWebKit import QWebSettings
        ## QWebSettings.globalSettings().setAttribute(
        ##     QWebSettings.DeveloperExtrasEnabled, True)

        button_image = QPushButton('Copy as Image')
        button_image.clicked.connect(self.set_clipboard_image)
        button_image.setToolTip('Then paste into any graphics program')
        button_word = QPushButton('Copy as MS Word Equation')
        button_word.clicked.connect(self.set_clipboard_word)
        button_html = QPushButton('Copy as Formatted Text')
        button_html.clicked.connect(self.set_clipboard_html)
        line = QFrame()
        line.setFrameShape(QFrame.HLine)
        line.setFrameShadow(QFrame.Sunken)

        button_layout = QHBoxLayout()
        button_layout.addStretch()
        button_layout.addWidget(button_image)
        button_layout.addWidget(button_word)
        button_layout.addWidget(button_html)
        source_layout = QHBoxLayout()
        source_layout.addWidget(self.compiler_view)
        source_layout.addWidget(self.stacked_widget, 1)
        QVBoxLayout(window)
        window.layout().addWidget(self.edit)
        window.layout().addWidget(self.view)
        window.layout().addLayout(button_layout)
        window.layout().addWidget(line)
        window.layout().addLayout(source_layout, 1)

        window.show()
        window.resize(window.minimumWidth(), window.height())
        # To prevent garbage collection of internal Qt object.
        self._window = window
Beispiel #23
0
    def __init__(self, parent):
        super(EditMovieWindow, self).__init__(parent)
        self.setModal(True)
        self.resize(500, 500)
        #self.setWindowTitle("Edit Movie: {}".format(movieObject.name))

        self.movieObject = None

        mainLayout = QVBoxLayout(self)

        getMoviesBtn = QPushButton("Get movies from Movie DB")

        self.resultListView = QListWidget()
        self.resultListView.itemDoubleClicked.connect(self.editData)

        mainLayout.addWidget(getMoviesBtn)
        mainLayout.addWidget(self.resultListView)

        getMoviesBtn.clicked.connect(self.getMoviesAction)
Beispiel #24
0
 def __init__(self):
 
     QScrollArea.__init__(self)
     self.mainWidget = QListWidget()
     self.setWidget(self.mainWidget)
     self.setWidgetResizable(True)        
             
     self.setFixedWidth(200)
     
     self.setTitle()      
Beispiel #25
0
 def initList(self):
     self.leftDock = QDockWidget()
     self.leftDock.setFeatures(
         QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
     QApplication.instance().doclist = QListWidget()
     QApplication.instance().doclist.itemDoubleClicked.connect(
         openDocumentAction)
     self.leftDock.setWidget(QApplication.instance().doclist)
     self.leftDock.setAllowedAreas(Qt.LeftDockWidgetArea)
     self.addDockWidget(Qt.LeftDockWidgetArea, self.leftDock)
Beispiel #26
0
 def __init__(self, parent):
 
     QScrollArea.__init__(self)
     self.parent = parent
     self.mainWidget = QListWidget()
     self.setWidget(self.mainWidget)
     self.setWidgetResizable(True)        
             
     self.setFixedHeight(130)
     
     self.setTitle()      
Beispiel #27
0
class managebkm(QDialog):
	def __init__(self, parent=None):
		super(managebkm, self).__init__(parent)
		appicom = QIcon(":/icons/njnlogo.png")
		self.setWindowIcon(appicom)
		self.setWindowTitle("Nigandu | Manage Book Marks")
		self.setFixedSize(463, 242)

		self.verticalLayoutWidget = QWidget(self)
		self.verticalLayoutWidget.setGeometry(QRect(350, 30, 101, 201))
		self.verticalLayoutWidget.setObjectName("verticalLayoutWidget")
		self.verticalLayout = QVBoxLayout(self.verticalLayoutWidget)
		self.verticalLayout.setContentsMargins(0, 0, 0, 0)
		self.verticalLayout.setObjectName("verticalLayout")

		self.sortbtn = QPushButton(self.verticalLayoutWidget)
		self.sortbtn.setText("&Sort")
		self.verticalLayout.addWidget(self.sortbtn)

		self.deletebtn = QPushButton(self.verticalLayoutWidget)
		self.deletebtn.setText("&Delete")
		self.verticalLayout.addWidget(self.deletebtn)

		self.deleteallbtn = QPushButton(self.verticalLayoutWidget)
		self.deleteallbtn.setText("Delete &All")
		self.verticalLayout.addWidget(self.deleteallbtn)

		self.closebtn = QPushButton(self.verticalLayoutWidget)
		self.closebtn.setText("&Close")
		self.verticalLayout.addWidget(self.closebtn)

		self.listWidget = QListWidget(self)
		self.listWidget.setGeometry(QRect(10, 30, 331, 201))

		self.label = QLabel(self)
		self.label.setGeometry(QRect(20, 10, 91, 25))
		font = QFont()
		font.setPointSize(10)
		self.label.setFont(font)
		self.label.setBuddy(self.listWidget)
		self.label.setText("Book Mark List:")
Beispiel #28
0
 def __init__(self, targetLayoutContainer):
     self.textarea = QTextEdit()
     self.commits = QListWidget()
     
     self.commits.addAction(QAction('Rollback to this revision', self.commits, triggered=self.rollback))
     self.commits.setContextMenuPolicy(Qt.ActionsContextMenu)
     
     self.widget = QTabWidget()
     self.widget.addTab(self.textarea, 'Log')
     self.widget.addTab(self.commits, 'Commits')
     
     targetLayoutContainer.addWidget(self.widget)
Beispiel #29
0
    def init ( self, parent ):
        """ Finishes initializing the editor by creating the underlying toolkit
            widget.
        """
        super( ListEditor, self ).init( parent )

        self.control = QListWidget( parent )
        QObject.connect( self.control, SIGNAL( 'currentTextChanged(QString)' ),
                         self.update_object )

        self.rebuild_editor()
        self.set_tooltip()
Beispiel #30
0
	def display(self):
		layout = QHBoxLayout()
		layout.setSpacing(10)

		# Left panel - repositories
		qlistWidget = QListWidget()
		for repo in self.args.user.repositories():
			qlistWidget.addItem(repo.name)
		layout.addWidget (qlistWidget)


		# Middle panel - commits
		commitsLabel = QLabel("There will be the commits")
		layout.addWidget (commitsLabel)

		# Something
		somethingLabel = QLabel("There will be something")
		layout.addWidget (somethingLabel)

		self.setLayout(layout)
		self.show()
Beispiel #31
0
    def _init_avoids_tab(self, tab):

        avoids_list = QListWidget()
        self._avoids_list = avoids_list

        layout = QVBoxLayout()
        layout.addWidget(avoids_list)

        frame = QFrame()
        frame.setLayout(layout)

        tab.addTab(frame, 'Avoids')
Beispiel #32
0
class HiddenDialog(QDialog):
   
    lifelines = None 

    def __init__(self, hiddenLifeline, parent = None):
        super(HiddenDialog, self).__init__(parent)

        self.lifelines = hiddenLifeline
        layout = QVBoxLayout(self)

        listTitle = QLabel('Hidden Life-lines')
        layout.addWidget(listTitle)

        self.listHiddenLifelines = QListWidget()
        self.listHiddenLifelines.setFixedWidth(400)
        self.listHiddenLifelines.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)

        for text in self.lifelines:
            item = QtGui.QListWidgetItem(text)
            self.listHiddenLifelines.addItem(item)

        layout.addWidget(self.listHiddenLifelines)

        buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        buttons.button(QDialogButtonBox.Ok).setText('Show')
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)

    @staticmethod
    def getSelectedItems(lifelines, parent = None):
        dialog = HiddenDialog(lifelines,parent)
        result = dialog.exec_()
        return (result, [str(x.text()) for x in dialog.listHiddenLifelines.selectedItems()])
Beispiel #33
0
class SideBar(QScrollArea):
    
    def __init__(self):
    
        QScrollArea.__init__(self)
        self.mainWidget = QListWidget()
        self.setWidget(self.mainWidget)
        self.setWidgetResizable(True)        
                
        self.setFixedWidth(200)
        
        self.setTitle()      
                   
                
    def setProperties(self, signal):
    
        self.mainWidget.clear()
        self.setTitle()
        
        
        for x in signal.properties:
            self.mainWidget.addItem("  " + x[0] + ": " + x[1])    
        
    def setTitle(self):
        self.mainWidget.addItem("Signal Properties")
Beispiel #34
0
class PropertyBar(QScrollArea):
    def __init__(self, parent):
    
        QScrollArea.__init__(self)
        self.parent = parent
        self.mainWidget = QListWidget()
        self.setWidget(self.mainWidget)
        self.setWidgetResizable(True)        
                
        self.setFixedHeight(130)
        
        self.setTitle()      
                   
                
    def setProperties(self):
    
        self.mainWidget.clear()
        self.setTitle() 
        
        if self.parent:
            for x in self.parent.project.experimentProperties:
                self.mainWidget.addItem("  " + x[0] + ": " + x[1])    
        
    def setTitle(self):
        self.mainWidget.addItem("Experiment Properties")
Beispiel #35
0
    def addTab(self, label):

        layoutWidget = QWidget()
        vLayout = QVBoxLayout(layoutWidget)
        vLayout.setContentsMargins(5, 5, 5, 5)

        setFolderLayout = QHBoxLayout()
        listWidget = QListWidget()
        listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)
        vLayout.addLayout(setFolderLayout)
        vLayout.addWidget(listWidget)

        lineEdit = QLineEdit()
        setFolderButton = QPushButton('Set Folder')

        setFolderLayout.addWidget(lineEdit)
        setFolderLayout.addWidget(setFolderButton)

        QtCore.QObject.connect(setFolderButton, QtCore.SIGNAL('clicked()'),
                               Functions.setFolder)
        QtCore.QObject.connect(listWidget,
                               QtCore.SIGNAL('itemSelectionChanged()'),
                               Functions.loadImagePathArea)
        QtCore.QObject.connect(lineEdit, QtCore.SIGNAL('textChanged()'),
                               Functions.lineEdited)

        listWidget.setObjectName(Window_global.listWidgetObjectName)
        lineEdit.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        lineEdit.setObjectName(Window_global.lineEditObjectName)

        lineEdit.returnPressed.connect(Functions.lineEdited)

        super(Tab, self).addTab(layoutWidget, label)
Beispiel #36
0
    def __init__(self, parent=None, opc=None):
        super(TagSelecion, self).__init__()

        self.opc = opc

        self.setTitle('Tag Selection')

        self.layout = QVBoxLayout(self)

        self.button_refresh = QPushButton('Refresh', self)
        self.button_refresh.clicked.connect(self._refresh)
        self.layout.addWidget(self.button_refresh)

        self.button_all = QPushButton('Select All', self)
        self.button_all.clicked.connect(self._select_all)
        self.layout.addWidget(self.button_all)

        self.button_none = QPushButton('Select None', self)
        self.button_none.clicked.connect(self._select_none)
        self.layout.addWidget(self.button_none)

        self.hbox_pattern = QHBoxLayout(self)
        self.button_pattern = QPushButton('Toggle Pattern', self)
        self.button_pattern.clicked.connect(self._toggle_pattern)
        self._next_toggle = 'select'
        self.hbox_pattern.addWidget(self.button_pattern)
        self.le_pattern = QLineEdit(self)
        self.le_pattern.setPlaceholderText('Pattern')
        self.hbox_pattern.addWidget(self.le_pattern)
        self.layout.addLayout(self.hbox_pattern)

        self.label = QLabel('Select Tags', self)
        self.layout.addWidget(self.label)

        self.listw_tags = QListWidget(self)
        self.listw_tags.setSelectionMode(QAbstractItemView.MultiSelection)
        self.layout.addWidget(self.listw_tags)

        self.setLayout(self.layout)
Beispiel #37
0
    def createWidgets(self):
        self.listWidget = QListWidget()
        self.buttonLayout = QVBoxLayout()
        for icon, text, slot, tip in ((":/add.svg", "&Add", self.add, """\
<p><b>Add</b></p><p>Add an item to the {}
list.</p>""".format(self.info.name)), (":/edit.svg", "&Edit", self.edit, """\
<p><b>Edit</b></p><p>Edit the {} list's current
item.</p>""".format(self.info.name)), (":/delete.svg", "&Remove...",
                                       self.remove, """\
<p><b>Remove</b></p><p>Remove the {} list's current
item.</p>""".format(self.info.name)), (":/help.svg", "Help", self.help, """\
Help on the {} dialog""".format(self.info.name)), (":/dialog-close.svg",
                                                   "&Close", self.accept, """\
<p><b>Close</b></p><p>Close the dialog.</p>""")):
            button = QPushButton(QIcon(icon), text)
            button.setFocusPolicy(Qt.NoFocus)
            if text in {"&Close", "Help"}:
                self.buttonLayout.addStretch()
            self.buttonLayout.addWidget(button)
            button.clicked.connect(slot)
            self.tooltips.append((button, tip))
        self.tooltips.append((self.listWidget, self.info.desc))
Beispiel #38
0
    def __init__(self, *args, **kwargs ):
        QWidget.__init__( self, *args, **kwargs )

        mainLayout = QVBoxLayout( self )
        mainLayout.setContentsMargins(0,0,0,0)
        listWidget = QListWidget()
        loadButton = QPushButton( "Load Constrain Targets" )
        mainLayout.addWidget( listWidget )
        mainLayout.addWidget( loadButton )
        
        self.listWidget = listWidget
        self.loadButton = loadButton
        QtCore.QObject.connect( self.loadButton, QtCore.SIGNAL( 'clicked()' ), self.loadConstrainTargets )
Beispiel #39
0
 def secondPage(self):
     
     for i in range( self.mainLayout.count() ):
         item = self.mainLayout.itemAt(0)
         item.widget().setParent( None )
     
     title = QLabel( "설치할 플러그인을 선택하십시오.".decode( 'utf-8' ) )
     title.setFixedHeight( 50 )
     
     listWidget = QListWidget()
     listWidget.setFixedHeight( 273 )
     widgetItem_for2015 = QListWidgetItem("PingoTools for Maya2015", listWidget )
     widgetItem_for2016 = QListWidgetItem("PingoTools for Maya2016", listWidget )
     widgetItem_for2017 = QListWidgetItem("PingoTools for Maya2017", listWidget )
     
     widgetItem_for2015.setCheckState( QtCore.Qt.Checked )
     widgetItem_for2016.setCheckState( QtCore.Qt.Checked )
     widgetItem_for2017.setCheckState( QtCore.Qt.Checked )
     #widgetItem_for2015.setFlags( not QtCore.Qt.ItemIsSelectable )
     
     buttonsWidget = QWidget(); buttonsWidget.setMaximumHeight( 50 )
     buttonsLayout = QHBoxLayout( buttonsWidget )
     emptyArea = QLabel()
     buttonBack = QPushButton( 'Back < ' )
     buttonNext = QPushButton( 'Install' )
     buttonCancel = QPushButton( 'Cancel' )
     buttonsLayout.addWidget( emptyArea )
     buttonsLayout.addWidget( buttonBack ); buttonBack.setFixedWidth( 100 )
     buttonsLayout.addWidget( buttonNext ); buttonNext.setFixedWidth( 100 )
     buttonsLayout.addWidget( buttonCancel ); buttonCancel.setFixedWidth( 100 )
     
     self.mainLayout.addWidget( title )
     self.mainLayout.addWidget( listWidget )
     self.mainLayout.addWidget( buttonsWidget )
     
     QtCore.QObject.connect( buttonBack, QtCore.SIGNAL( 'clicked()' ), self.firstPage )
     QtCore.QObject.connect( buttonNext, QtCore.SIGNAL( 'clicked()' ), self.lastPage )
     QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL( 'clicked()' ), self.cmd_cancel )
Beispiel #40
0
class EditMovieWindow(QDialog):
    def __init__(self, parent):
        super(EditMovieWindow, self).__init__(parent)
        self.setModal(True)
        self.resize(500, 500)
        #self.setWindowTitle("Edit Movie: {}".format(movieObject.name))

        self.movieObject = None

        mainLayout = QVBoxLayout(self)

        getMoviesBtn = QPushButton("Get movies from Movie DB")

        self.resultListView = QListWidget()
        self.resultListView.itemDoubleClicked.connect(self.editData)

        mainLayout.addWidget(getMoviesBtn)
        mainLayout.addWidget(self.resultListView)

        getMoviesBtn.clicked.connect(self.getMoviesAction)

    def getMoviesAction(self):
        movieList = dataDownloader.movieDBSearch(self.movieObject.name)

        for movie in movieList:
            movieItem = MovieItem(movie, self.restultListView)

    def editData(self):
        selectedItem = self.resultListView.currentItem()

        data = selectedItem.movieData

        # todo download new poster
        if data["poster_path"]:
            dataDownloader.downloadImage(data["poster_path"],
                                         self.movieObject.name)

        # todo download backdrop image
        if data["backdrop_path"]:
            dataDownloader.downloadImage(data["backdrop_path"],
                                         self.movieObject.name)

        # todo edit data in database
        self.movieObject.editData(data)

        self.accept()

    def setMovie(self, movieObject):
        self.setWindowTitle("Edit Movie: {}".format(movieObject.name))
        self.movieObject
Beispiel #41
0
    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_SubscriberDialog()
        self.ui.setupUi(self)

        self.subscriber = None
        self.tableWidget = None
        self.listWidget = None

        if USE_MAEMO_5:
            switchButton = self.ui.buttonBox.addButton(self.tr('Switch'), QDialogButtonBox.ActionRole)
            switchButton.clicked.connect(self.switchRequested)

            self.tableWidget = self.ui.tableWidget
            headerLabels = ('Key', 'Value', 'Type')
            self.tableWidget.setColumnCount(3)
            self.tableWidget.setHorizontalHeaderLabels(headerLabels)
            horizontalHeader = self.tableWidget.horizontalHeader()
            horizontalHeader.setStretchLastSection(True)
            verticalHeader = self.tableWidget.verticalHeader()
            verticalHeader.setVisible(False)
            self.tableWidget.setColumnWidth(0, 200)
            self.tableWidget.setColumnWidth(1, 400)
        else:
            desktopWidget = QDesktopWidget()
            if desktopWidget.availableGeometry().width() < 400:
                # Screen is too small to fit a table widget without scrolling, use a list widget instead.
                self.listWidget = QListWidget()
                self.listWidget.setAlternatingRowColors(True)
                self.ui.verticalLayout.insertWidget(2, self.listWidget)
            else:
                self.tableWidget = QTableWidget()
                headerLabels = ('Key', 'Value', 'Type')
                self.tableWidget.setColumnCount(3)
                self.tableWidget.setHorizontalHeaderLabels(headerLabels)
                horizontalHeader = self.tableWidget.horizontalHeader()
                horizontalHeader.setStretchLastSection(True)
                self.tableWidget.verticalHeader()
                self.setVisible(False)
                self.ui.verticalLayout.insertWidget(2, self.tableWidget)

        self.ui.connectButton.clicked.connect(self.changeSubscriberPath)
        self.changeSubscriberPath()

        # if the default path does not exist reset it to /
        value = self.subscriber.value()
        subPaths = self.subscriber.subPaths()
        if not value and not subPaths:
            self.ui.basePath.setText('/')
            self.changeSubscriberPath()
    def __init__(self, *args, **kwargs ):

        super(Widget_target, self).__init__(*args, **kwargs )
        mainLayout = QVBoxLayout( self ); mainLayout.setContentsMargins( 10,0,10,0 ); mainLayout.setSpacing(0)

        w_loadObject = Widget_loadObject( title="Target" )
        listWidget = QListWidget()

        mainLayout.addWidget( w_loadObject )
        mainLayout.addWidget( listWidget )

        self.w_loadObject = w_loadObject
        self.listWidget = listWidget
        w_loadObject.button.clicked.connect( self.load_textures )
Beispiel #43
0
    def __init__(self, hiddenLifeline, parent = None):
        super(HiddenDialog, self).__init__(parent)

        self.lifelines = hiddenLifeline
        layout = QVBoxLayout(self)

        listTitle = QLabel('Hidden Life-lines')
        layout.addWidget(listTitle)

        self.listHiddenLifelines = QListWidget()
        self.listHiddenLifelines.setFixedWidth(400)
        self.listHiddenLifelines.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)

        for text in self.lifelines:
            item = QtGui.QListWidgetItem(text)
            self.listHiddenLifelines.addItem(item)

        layout.addWidget(self.listHiddenLifelines)

        buttons = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
        buttons.button(QDialogButtonBox.Ok).setText('Show')
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        layout.addWidget(buttons)
Beispiel #44
0
 def __init__(self, parent):
     ''' Create an autocompletion list popup '''
     widget = QListWidget()
     super(Completer, self).__init__(parent)
     self.setWidget(widget)
     self.string_list = QStringListModel()
     self._completer = QCompleter()
     self.parent = parent
     self._completer.setCaseSensitivity(Qt.CaseInsensitive)
     # For some reason the default minimum size is (61,61)
     # Set it to 0 so that the size of the box is not taken
     # into account when it is hidden.
     self.setMinimumSize(0, 0)
     self.prepareGeometryChange()
     self.resize(0, 0)
     self.hide()
Beispiel #45
0
class ListWindow(QWidget):
    def __init__(self, list_text, pic_path):
        super(ListWindow, self).__init__()
        self.doubleclick_fun = None
        self._set_items(list_text, pic_path)

    def _set_items(self, list_text, pic_path):
        """
        set the layout of listwidget
        :param list_text: list contains [title, subtitle]
        :param pic_path: string or list of strings
        """
        print list_text
        self.list_widget = QListWidget()
        ly_vbox = QVBoxLayout()
        if type(pic_path) is not list:
            for item in list_text:
                self._setItem(item[0], item[1], pic_path)
        else:
            for i in range(len(list_text)):
                self._setItem(list_text[i][0], list_text[i][1], pic_path[i])
        ly_vbox.addWidget(self.list_widget)
        self.list_widget.itemDoubleClicked.connect(self.item_doubleclick_slot)
        self.setLayout(ly_vbox)
        self.resize(300, 400)

        buttonBox = QDialogButtonBox(QDialogButtonBox.Ok |QDialogButtonBox.Cancel)
        ly_vbox.addWidget(buttonBox)
        buttonBox.accepted.connect(self.check_test)
        buttonBox.rejected.connect(self.reject)
        self.check_test()

    def check_test(self):
        pass

    def reject(self):
        print "XX"

    def _setItem(self, title, subtitle, pic_path):
        item_widget = QListWidgetItem()
        item_widget.setSizeHint(QSize(90, 60))
        self.list_widget.addItem(item_widget)

        label = MyLable(title, subtitle, pic_path)
        self.list_widget.setItemWidget(item_widget, label)

    def item_doubleclick_slot(self):
        if self.doubleclick_fun:
            widget = self.list_widget.itemWidget(self.list_widget.currentItem()) # get MyLabel widget
            self.doubleclick_fun(widget.get_lb_title(), widget.get_lb_subtitle())

    def set_doubleclick_slot(self, fun):
        """set item double click slot"""
        self.doubleclick_fun = fun
class GUIdot_cleanMac(QDialog):
    def __init__(self, parent = None):
        super(GUIdot_cleanMac, self).__init__(parent)
        siguiente_btn = QPushButton('Siguiente')
        layout = QVBoxLayout()
        layout.addWidget(QLabel('Seleccione memoria:'))
        hlayout = QHBoxLayout()
        hlayout.addStretch()
        hlayout.addWidget(siguiente_btn)
        self.lista = QListWidget()
        nodos = self.getNodos()
        self.lista.addItems(nodos)
        layout.addWidget(self.lista)
        layout.addLayout(hlayout)
        layout.addWidget(QLabel('Hecho por: www.ehmsoft.com'))
        self.setLayout(layout)
        self.connect(siguiente_btn, SIGNAL('clicked()'), self.siguienteClicked)
        self.setWindowTitle('Dot Clean')
        if len(nodos) > 0:
            self.lista.setCurrentRow(0)

    def getNodos(self): #Lista todos los volumenes y quita el Disco Duro del sistema
        path = '/Volumes'
        folders = os.listdir(path)
        try:
            folders.remove('Macintosh HD')
        except ValueError:
            carpetas = copy.copy(folders)
            for folder in carpetas:
                if os.path.isdir(os.path.join('/Volumes', folder)):
                    if os.path.exists(os.path.join('/Volumes', folder, 'Applications')):
                        folders.remove(folder)
        finally:
            return folders
        
    def dot_clean(self, path):
        return os.system('dot_clean %s' % path)
    
    def siguienteClicked(self):
        if self.lista.currentItem():
            selected = self.lista.currentItem().text()
            path = os.path.join('/Volumes', selected)
            if self.dot_clean(path) == 0:
                title = 'Proceso exitoso'
                msg = u'Se limpió la memoria con éxito'
            else:
                title = 'Proceso fallido'
                msg = u'Ocurrió un error inesperado. Verifique que la memoria esté montada.'
        else:
            title = 'Proceso fallido'
            msg = u'No se encuentra ninguna memoria, por favor introduzca una y vuelva a iniciar la apliación'
        QMessageBox.information(self, title, msg)
        self.close()
Beispiel #47
0
	def __init__(self, parent=None):
		super(EditPreferencesDlg, self).__init__(parent)
		self.setWindowTitle("Preferences")
		# define widgets
		pref_list = QListWidget()
		pref_list.addItem("General")
		pref_list.addItem("Display")
		pref_list.setMaximumWidth(150)
		pref_list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
		
		button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
		
		general_page = QWidget()
		general_layout = QGridLayout()
		general_layout.setAlignment(Qt.AlignTop)
		general_layout.addWidget(QLabel("<b>General</b>"), 0, 0)
		general_page.setLayout(general_layout)
		
		display_page = QWidget()
		display_layout = QGridLayout()
		display_layout.setAlignment(Qt.AlignTop)
		display_layout.addWidget(QLabel("<b>Display Options</b>"), 0, 0)
		self.multitabs_checkbox = QCheckBox("Limit the display of tabs to one relief device (and the device's scenarios) at a time")
		if parent.limit_tabs is True:
			self.multitabs_checkbox.setChecked(True)
		display_layout.addWidget(self.multitabs_checkbox, 1, 0)
		display_page.setLayout(display_layout)

		stacked_widget = QStackedWidget()
		for page in general_page, display_page:
			stacked_widget.addWidget(page)
		
		main_layout = QVBoxLayout()
		widgets_layout = QHBoxLayout()
		widgets_layout.addWidget(pref_list)
		widgets_layout.addWidget(stacked_widget)
		buttons_layout = QHBoxLayout()
		buttons_layout.addStretch()
		buttons_layout.addWidget(button_box)
		main_layout.addLayout(widgets_layout)
		main_layout.addLayout(buttons_layout)
		self.setLayout(main_layout)
		
		pref_list.currentRowChanged.connect(stacked_widget.setCurrentIndex)
		
		button_box.accepted.connect(self.accept)
		button_box.rejected.connect(self.reject)
 def __init__(self, parent = None):
     super(GUIdot_cleanMac, self).__init__(parent)
     siguiente_btn = QPushButton('Siguiente')
     layout = QVBoxLayout()
     layout.addWidget(QLabel('Seleccione memoria:'))
     hlayout = QHBoxLayout()
     hlayout.addStretch()
     hlayout.addWidget(siguiente_btn)
     self.lista = QListWidget()
     nodos = self.getNodos()
     self.lista.addItems(nodos)
     layout.addWidget(self.lista)
     layout.addLayout(hlayout)
     layout.addWidget(QLabel('Hecho por: www.ehmsoft.com'))
     self.setLayout(layout)
     self.connect(siguiente_btn, SIGNAL('clicked()'), self.siguienteClicked)
     self.setWindowTitle('Dot Clean')
     if len(nodos) > 0:
         self.lista.setCurrentRow(0)
Beispiel #49
0
    def __init__(self, *args, **kwargs):

        existing_widgets = args[0].findChildren(
            QDialog, Dialog_ReplacePath_last.objectName)
        if existing_widgets: map(lambda x: x.deleteLater(), existing_widgets)

        super(Dialog_ReplacePath_last, self).__init__(*args, **kwargs)
        self.installEventFilter(self)
        self.setObjectName(Dialog_ReplacePath_last.objectName)
        self.setWindowTitle(Window.title)
        mainLayout = QVBoxLayout(self)

        w_msg = QLabel("0 Items aleady exists. Do you want to replace it?")
        w_list = QListWidget()
        w_buttons = QWidget()
        lay_buttons = QHBoxLayout(w_buttons)
        button_replace = QPushButton("Replace All")
        button_noReplace = QPushButton("Do not Replace")
        button_cancel = QPushButton("Cancel")
        lay_buttons.addWidget(button_replace)
        button_replace.setFixedWidth(120)
        lay_buttons.addWidget(button_noReplace)
        lay_buttons.addWidget(button_cancel)

        mainLayout.addWidget(w_msg)
        mainLayout.addWidget(w_list)
        mainLayout.addWidget(w_buttons)

        self.button_replace = button_replace
        self.w_list = w_list
        self.w_msg = w_msg
        self.w_list.setSelectionMode(QAbstractItemView.ExtendedSelection)

        QtCore.QObject.connect(button_replace, QtCore.SIGNAL("clicked()"),
                               self.cmd_replace)
        QtCore.QObject.connect(button_noReplace, QtCore.SIGNAL("clicked()"),
                               self.cmd_noReplace)
        QtCore.QObject.connect(button_cancel, QtCore.SIGNAL("clicked()"),
                               self.deleteLater)
        QtCore.QObject.connect(self.w_list,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.changeButtonCondition)
        self.items = []
Beispiel #50
0
    def __init__(self, *args, **kwargs):

        super(Dialog_deleteUnused, self).__init__(*args, **kwargs)
        self.installEventFilter(self)
        self.setObjectName(Dialog_deleteUnused.objectName)
        self.setWindowTitle(Dialog_deleteUnused.title)
        self.resize(Dialog_deleteUnused.defaultWidth,
                    Dialog_deleteUnused.defaultHeight)

        mainLayout = QVBoxLayout(self)
        label_download = QLabel(
            "The following files will be deleted. Continue?".decode('utf-8'))
        label_download.setMaximumHeight(30)
        scrollArea = QScrollArea()
        fileList = QListWidget()
        scrollArea.setWidget(fileList)
        scrollArea.setWidgetResizable(True)
        hLayout_buttons = QHBoxLayout()
        button_delete = QPushButton("Delete All".decode('utf-8'))
        button_cancel = QPushButton("Cancel".decode('utf-8'))
        hLayout_buttons.addWidget(button_delete)
        hLayout_buttons.addWidget(button_cancel)
        mainLayout.addWidget(label_download)
        mainLayout.addWidget(scrollArea)
        mainLayout.addLayout(hLayout_buttons)

        self.fileList = fileList
        self.button_delete = button_delete

        QtCore.QObject.connect(button_delete, QtCore.SIGNAL('clicked()'),
                               self.cmd_deleteSelected)
        QtCore.QObject.connect(button_cancel, QtCore.SIGNAL('clicked()'),
                               self.cmd_cancel)
        QtCore.QObject.connect(self.fileList,
                               QtCore.SIGNAL("itemSelectionChanged()"),
                               self.cmd_setButtonCondition)

        self.fileList.setSelectionMode(QAbstractItemView.ExtendedSelection)
Beispiel #51
0
    def __init__(self, items):  # , parent=None
        super(MultiListDialog, self).__init__()  # parent
        self.resize(800, 550)
        self.entries = items
        layout = QVBoxLayout(self)

        self.listWidget = QListWidget(self)
        self.listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.HlineInputfiles = ConfigLineDir(u"Verzeichnis NI XML:", "dir")
        self.HlineOutputfiles = ConfigLineDir(u"Verzeichnis Report:", "dir")
        if os.path.isfile(PICKLE_TEMP_FILE):
            pkl_file = open(PICKLE_TEMP_FILE, 'rb')
            inPath = pickle.load(pkl_file)
            outPath = pickle.load(pkl_file)
            pkl_file.close()
            if os.path.isdir(inPath):
                self.HlineInputfiles.editText.setText(inPath)
            if os.path.isdir(outPath):
                self.HlineOutputfiles.editText.setText(outPath)
        layout.addLayout(self.HlineInputfiles)
        layout.addLayout(self.HlineOutputfiles)
        layout.addWidget(self.listWidget)

        layout.addWidget(QLabel("Mehrfachauswahl -> Strg + Mausklick"))

        # OK and Cancel buttons
        buttons = QDialogButtonBox(QDialogButtonBox.Apply | QDialogButtonBox.Close, Qt.Horizontal, self)
        # Apply before Close
        buttons.setStyleSheet("* { button-layout: 2 }")
        layout.addWidget(buttons)

        buttons.rejected.connect(self.close)
        buttons.button(QDialogButtonBox.Apply).clicked.connect(self.Apply_Clicked)

        self.SetListItems()
        self.HlineInputfiles.editText.textChanged.connect(self.RefreshList)
        self.HlineInputfiles.editText.textChanged.connect(self.SetListItems)
Beispiel #52
0
    def __init__(self, *args, **kwargs):

        title = ""
        if kwargs.has_key("title"):
            title = kwargs.pop("title")

        super(GroupBox_targetMeshs, self).__init__(*args, **kwargs)
        self.setTitle(title)

        listWidget = QListWidget()
        button = QPushButton("Load Selected")

        mainLayout = QVBoxLayout(self)
        mainLayout.setSpacing(0)
        mainLayout.addWidget(listWidget)
        mainLayout.addWidget(button)

        self.title = title
        self.listWidget = listWidget
        QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"),
                               self.loadSelected)

        WidgetInfo(self.listWidget).loadItems(
            Window.infoPath, "GroupBox_targetMeshs_%s_listWidget" % title)
Beispiel #53
0
 def setup(self):
     
     self.dirty = False
     
     self.def_cfg = copy.deepcopy(self.config)
     self.config.update_from_user_file()
     self.base_cfg = copy.deepcopy(self.config)
     
     self.categories = QListWidget()
     #self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
     self.settings = QStackedWidget()
     #self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
     
     QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
     
     self.widget_list = {}
     for cat in self.config.get_categories():
         self.widget_list[cat] = {}
     longest_cat = 0
     for cat in self.config.get_categories():
         if len(cat) > longest_cat:
             longest_cat = len(cat)
         self.categories.addItem(cat)
         settings_layout = QGridLayout()
         r = 0
         c = 0
         for setting in self.config.get_settings(cat):
             info = self.config.get_setting(cat, setting, True)
             s = QWidget()
             s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             sl = QVBoxLayout()
             label = QLabel()
             if info.has_key('alias'):
                 label.setText(info['alias'])
             else:
                 label.setText(setting)
             if info.has_key('about'):
                 label.setToolTip(info['about'])
             sl.addWidget(label)
             if info['type'] == constants.CT_LINEEDIT:
                 w = LineEdit(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_CHECKBOX:
                 w = CheckBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_SPINBOX:
                 w = SpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_DBLSPINBOX:
                 w = DoubleSpinBox(self, self.config,cat,setting,info)
             elif info['type'] == constants.CT_COMBO:
                 w = ComboBox(self, self.config,cat,setting,info)
             w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
             self.widget_list[cat][setting] = w
             sl.addWidget(w)
             s.setLayout(sl)
             c = self.config.config[cat].index(setting) % 2
             settings_layout.addWidget(s, r, c)
             if c == 1:
                 r += 1
         settings = QWidget()
         settings.setLayout(settings_layout)
         settings_scroller = QScrollArea()
         settings_scroller.setWidget(settings)
         settings_scroller.setWidgetResizable(True)
         self.settings.addWidget(settings_scroller)
         
     font = self.categories.font()
     fm = QFontMetrics(font)
     self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
     
     self.main = QWidget()
     self.main_layout = QVBoxLayout()
     
     self.config_layout = QHBoxLayout()
     self.config_layout.addWidget(self.categories)
     self.config_layout.addWidget(self.settings)
     
     self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
     self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
     self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
     self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
     QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
     
     self.dirty_check()
     
     self.main_layout.addLayout(self.config_layout)
     self.main_layout.addWidget(self.mainButtons)
     
     self.main.setLayout(self.main_layout)
     
     self.setCentralWidget(self.main)
     self.setWindowTitle(self.title)
     self.setUnifiedTitleAndToolBarOnMac(True)
     
     self.categories.setCurrentItem(self.categories.item(0))
     
     self.menuBar = QMenuBar()
     self.filemenu = QMenu('&File')
     self.quitAction = QAction(self)
     self.quitAction.setText('&Quit')
     if platform.system() != 'Darwin':
         self.quitAction.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
     QObject.connect(self.quitAction, SIGNAL('triggered()'), self.quitApp)
     self.filemenu.addAction(self.quitAction)
     self.menuBar.addMenu(self.filemenu)
     self.setMenuBar(self.menuBar)
     
     self.show()
     self.activateWindow()
     self.raise_()
     
     self.setMinimumWidth(self.geometry().width()*1.2)
     
     screen = QDesktopWidget().screenGeometry()
     size = self.geometry()
     self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
Beispiel #54
0
class ConfigEditor(QMainWindow):
    
    def __init__(self, app, cfg, title='Config Editor'):
        super(ConfigEditor, self).__init__()
        
        self.app = app
        self.config = cfg
        self.title = title
        
    def setup(self):
        
        self.dirty = False
        
        self.def_cfg = copy.deepcopy(self.config)
        self.config.update_from_user_file()
        self.base_cfg = copy.deepcopy(self.config)
        
        self.categories = QListWidget()
        #self.categories.setSizePolicy(QSizePolicy.Fixed,QSizePolicy.Expanding)
        self.settings = QStackedWidget()
        #self.categories.setSizePolicy(QSizePolicy.MinimumExpanding,QSizePolicy.Expanding)
        
        QObject.connect(self.categories, SIGNAL('itemSelectionChanged()'), self.category_selected)
        
        self.widget_list = {}
        for cat in self.config.get_categories():
            self.widget_list[cat] = {}
        longest_cat = 0
        for cat in self.config.get_categories():
            if len(cat) > longest_cat:
                longest_cat = len(cat)
            self.categories.addItem(cat)
            settings_layout = QGridLayout()
            r = 0
            c = 0
            for setting in self.config.get_settings(cat):
                info = self.config.get_setting(cat, setting, True)
                s = QWidget()
                s.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
                sl = QVBoxLayout()
                label = QLabel()
                if info.has_key('alias'):
                    label.setText(info['alias'])
                else:
                    label.setText(setting)
                if info.has_key('about'):
                    label.setToolTip(info['about'])
                sl.addWidget(label)
                if info['type'] == constants.CT_LINEEDIT:
                    w = LineEdit(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_CHECKBOX:
                    w = CheckBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_SPINBOX:
                    w = SpinBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_DBLSPINBOX:
                    w = DoubleSpinBox(self, self.config,cat,setting,info)
                elif info['type'] == constants.CT_COMBO:
                    w = ComboBox(self, self.config,cat,setting,info)
                w.setSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed)
                self.widget_list[cat][setting] = w
                sl.addWidget(w)
                s.setLayout(sl)
                c = self.config.config[cat].index(setting) % 2
                settings_layout.addWidget(s, r, c)
                if c == 1:
                    r += 1
            settings = QWidget()
            settings.setLayout(settings_layout)
            settings_scroller = QScrollArea()
            settings_scroller.setWidget(settings)
            settings_scroller.setWidgetResizable(True)
            self.settings.addWidget(settings_scroller)
            
        font = self.categories.font()
        fm = QFontMetrics(font)
        self.categories.setMaximumWidth(fm.widthChar('X')*(longest_cat+4))
        
        self.main = QWidget()
        self.main_layout = QVBoxLayout()
        
        self.config_layout = QHBoxLayout()
        self.config_layout.addWidget(self.categories)
        self.config_layout.addWidget(self.settings)
        
        self.mainButtons = QDialogButtonBox(QDialogButtonBox.RestoreDefaults | QDialogButtonBox.Reset | QDialogButtonBox.Apply)
        self.main_apply = self.mainButtons.button(QDialogButtonBox.StandardButton.Apply)
        self.main_reset = self.mainButtons.button(QDialogButtonBox.StandardButton.Reset)
        self.main_defaults = self.mainButtons.button(QDialogButtonBox.StandardButton.LastButton)
        QObject.connect(self.mainButtons, SIGNAL('clicked(QAbstractButton *)'), self.mainbutton_clicked)
        
        self.dirty_check()
        
        self.main_layout.addLayout(self.config_layout)
        self.main_layout.addWidget(self.mainButtons)
        
        self.main.setLayout(self.main_layout)
        
        self.setCentralWidget(self.main)
        self.setWindowTitle(self.title)
        self.setUnifiedTitleAndToolBarOnMac(True)
        
        self.categories.setCurrentItem(self.categories.item(0))
        
        self.menuBar = QMenuBar()
        self.filemenu = QMenu('&File')
        self.quitAction = QAction(self)
        self.quitAction.setText('&Quit')
        if platform.system() != 'Darwin':
            self.quitAction.setShortcut(QKeySequence(Qt.CTRL + Qt.Key_Q))
        QObject.connect(self.quitAction, SIGNAL('triggered()'), self.quitApp)
        self.filemenu.addAction(self.quitAction)
        self.menuBar.addMenu(self.filemenu)
        self.setMenuBar(self.menuBar)
        
        self.show()
        self.activateWindow()
        self.raise_()
        
        self.setMinimumWidth(self.geometry().width()*1.2)
        
        screen = QDesktopWidget().screenGeometry()
        size = self.geometry()
        self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2)
        
    def category_selected(self):
        self.settings.setCurrentIndex(self.config.config.index(self.categories.selectedItems()[0].text()))
        
    def mainbutton_clicked(self, button):
        if button == self.main_reset:
            for cat in self.base_cfg.get_categories():
                for setting in self.base_cfg.get_settings(cat):
                    self.widget_list[cat][setting].updateValue(self.base_cfg.get_setting(cat,setting))
        elif button == self.main_defaults:
            for cat in self.def_cfg.get_categories():
                for setting in self.def_cfg.get_settings(cat):
                    self.widget_list[cat][setting].updateValue(self.def_cfg.get_setting(cat,setting))
        elif button == self.main_apply:
            bad_settings = self.validate_settings()
            if bad_settings == []:
                self.save_settings()
                self.main_apply.setEnabled(False)
                self.main_reset.setEnabled(False)
            else:
                msgBox = QMessageBox()
                msgBox.setText("Must fix the following invalid settings before quitting:")
                msgBox.setStandardButtons(QMessageBox.Ok)
                info = ''
                for setting in bad_settings:
                    new = '%s,%s<br>' % setting
                    info = '%s%s' % (info, new)
                msgBox.setInformativeText(info)
                msgBox.exec_()
            
        
    def quitApp(self):
        self.app.closeAllWindows()
        
    def get_changes(self):
        enc = MyEncoder()
        if enc.encode(self.def_cfg.config) == enc.encode(self.config.config):
            return False
        if enc.encode(self.base_cfg.config) != enc.encode(self.config.config):
            newC = Config()
            for c in self.config.config.keys():
                for s in self.config.config[c].keys():
                    if self.config.config[c][s]['value'] != self.def_cfg.config[c][s]['value']:
                        newC.add_setting(c, s, self.config.config[c][s]['value'], stub=True)    
            return json.dumps(newC.config, separators=(',',': '), indent=4, sort_keys=True)
        else:
            return None
        
    def validate_settings(self):
        ret = []
        for cat in self.config.get_categories():
            for setting in self.config.get_settings(cat):
                info = self.config.get_setting(cat, setting, True)
                if info.has_key('validate'):
                    if not info['validate'](info):
                        ret.append((cat,setting))
        return ret
    
    def dirty_check(self):
        if str(self.base_cfg) != str(self.config):
            self.dirty = True
            self.main_apply.setEnabled(True)
            self.main_reset.setEnabled(True)
        else:
            self.dirty = False
            self.main_apply.setEnabled(False)
            self.main_reset.setEnabled(False)
        if str(self.def_cfg) == str(self.config):
            self.main_defaults.setEnabled(False)
        else:
            self.main_defaults.setEnabled(True)
            
    def save_settings(self):
        config = self.get_changes()
        if config == False:
            if os.path.isfile(self.config.user_file):
                os.remove(self.config.user_file)
        elif config != None:
            with open(self.config.user_file, 'w+') as f:
                f.write(config)
        self.base_cfg = copy.deepcopy(self.config)
            
    def closeEvent(self, event=None):
        self.quitApp()
Beispiel #55
0
class SubscriberDialog(QDialog):

    if USE_MAEMO_5:
        switchRequested = Signal()

    def __init__(self, parent=None):
        QDialog.__init__(self, parent)
        self.ui = Ui_SubscriberDialog()
        self.ui.setupUi(self)

        self.subscriber = None
        self.tableWidget = None
        self.listWidget = None

        if USE_MAEMO_5:
            switchButton = self.ui.buttonBox.addButton(self.tr('Switch'), QDialogButtonBox.ActionRole)
            switchButton.clicked.connect(self.switchRequested)

            self.tableWidget = self.ui.tableWidget
            headerLabels = ('Key', 'Value', 'Type')
            self.tableWidget.setColumnCount(3)
            self.tableWidget.setHorizontalHeaderLabels(headerLabels)
            horizontalHeader = self.tableWidget.horizontalHeader()
            horizontalHeader.setStretchLastSection(True)
            verticalHeader = self.tableWidget.verticalHeader()
            verticalHeader.setVisible(False)
            self.tableWidget.setColumnWidth(0, 200)
            self.tableWidget.setColumnWidth(1, 400)
        else:
            desktopWidget = QDesktopWidget()
            if desktopWidget.availableGeometry().width() < 400:
                # Screen is too small to fit a table widget without scrolling, use a list widget instead.
                self.listWidget = QListWidget()
                self.listWidget.setAlternatingRowColors(True)
                self.ui.verticalLayout.insertWidget(2, self.listWidget)
            else:
                self.tableWidget = QTableWidget()
                headerLabels = ('Key', 'Value', 'Type')
                self.tableWidget.setColumnCount(3)
                self.tableWidget.setHorizontalHeaderLabels(headerLabels)
                horizontalHeader = self.tableWidget.horizontalHeader()
                horizontalHeader.setStretchLastSection(True)
                self.tableWidget.verticalHeader()
                self.setVisible(False)
                self.ui.verticalLayout.insertWidget(2, self.tableWidget)

        self.ui.connectButton.clicked.connect(self.changeSubscriberPath)
        self.changeSubscriberPath()

        # if the default path does not exist reset it to /
        value = self.subscriber.value()
        subPaths = self.subscriber.subPaths()
        if not value and not subPaths:
            self.ui.basePath.setText('/')
            self.changeSubscriberPath()

    def changeEvent(self, e):
        QDialog.changeEvent(self, e)
        if e.type() == QEvent.LanguageChange:
            self.ui.retranslateUi(self)

    def changeSubscriberPath(self):
        if self.listWidget:
            self.listWidget.clear()
        elif self.tableWidget:
            self.tableWidget.clearContents()

        if not self.subscriber:
            self.subscriber = QValueSpaceSubscriber(self.ui.basePath.text(), self)
        else:
            self.subscriber.setPath(self.ui.basePath.text())

        self.subscriber.contentsChanged.connect(self.subscriberChanged)
        self.subscriber.connectNotify("contentsChanged()")
        self.subscriberChanged()

    def subscriberChanged(self):
        subPaths = self.subscriber.subPaths()

        if self.listWidget:
            self.listWidget.clear()
        elif self.tableWidget:
            self.tableWidget.clearContents()
            self.tableWidget.setRowCount(len(subPaths))

        for i in xrange(len(subPaths)):
            v = self.subscriber.value(subPaths[i])
            if self.listWidget:
                item = QListWidgetItem('%s (%s)\n%s' % (subPaths[i], str(type(v)), str(v)))
                item.setFlags(item.flags() & ~Qt.ItemIsEditable)
                self.listWidget.addItem(item)
            elif self.tableWidget:
                pathItem = QTableWidgetItem(subPaths[i])
                pathItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                valueItem = QTableWidgetItem(str(v))
                valueItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)
                typeItem = QTableWidgetItem(str(type(v)))
                typeItem.setFlags(pathItem.flags() & ~Qt.ItemIsEditable)

                self.tableWidget.setItem(i, 0, pathItem)
                self.tableWidget.setItem(i, 1, valueItem)
                self.tableWidget.setItem(i, 2, typeItem)
Beispiel #56
0
class MultiListDialog(QDialog):
    def __init__(self, items):  # , parent=None
        super(MultiListDialog, self).__init__()  # parent
        self.resize(800, 550)
        self.entries = items
        layout = QVBoxLayout(self)

        self.listWidget = QListWidget(self)
        self.listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection)

        self.HlineInputfiles = ConfigLineDir(u"Verzeichnis NI XML:", "dir")
        self.HlineOutputfiles = ConfigLineDir(u"Verzeichnis Report:", "dir")
        if os.path.isfile(PICKLE_TEMP_FILE):
            pkl_file = open(PICKLE_TEMP_FILE, 'rb')
            inPath = pickle.load(pkl_file)
            outPath = pickle.load(pkl_file)
            pkl_file.close()
            if os.path.isdir(inPath):
                self.HlineInputfiles.editText.setText(inPath)
            if os.path.isdir(outPath):
                self.HlineOutputfiles.editText.setText(outPath)
        layout.addLayout(self.HlineInputfiles)
        layout.addLayout(self.HlineOutputfiles)
        layout.addWidget(self.listWidget)

        layout.addWidget(QLabel("Mehrfachauswahl -> Strg + Mausklick"))

        # OK and Cancel buttons
        buttons = QDialogButtonBox(QDialogButtonBox.Apply | QDialogButtonBox.Close, Qt.Horizontal, self)
        # Apply before Close
        buttons.setStyleSheet("* { button-layout: 2 }")
        layout.addWidget(buttons)

        buttons.rejected.connect(self.close)
        buttons.button(QDialogButtonBox.Apply).clicked.connect(self.Apply_Clicked)

        self.SetListItems()
        self.HlineInputfiles.editText.textChanged.connect(self.RefreshList)
        self.HlineInputfiles.editText.textChanged.connect(self.SetListItems)

    # def SetOutputDir(self):
    #     self.HlineOutputfiles.editText.setText(self.HlineInputfiles.getText())

    def SetListItems(self, parent=None):
        itemslist = os.listdir(self.HlineInputfiles.getText())
        for it in itemslist:
            if it.endswith(".xml"):
                self.listWidget.addItem(it)

    def GetMarkedItems(self):
        results = []
        try:
            for el in self.listWidget.selectedItems():
                results.append(str(el.text()))
            return (results)

        except:
            return (None)

    def RefreshList(self):
        self.listWidget.clear()
        print "refresh"

    def Apply_Clicked(self):
        SelectedItems = self.GetMarkedItems()
        textMsg = "Selektierte Dateie(n):\r\n"
        if len(SelectedItems) > 0:
            for file in SelectedItems:
                filePath = os.path.join(self.HlineInputfiles.getText(), file)
                textMsg += (file + "\r\n")
                XmlAnalysis.XmlAnalysis(filePath, self.HlineOutputfiles.getText())

            #QMessageBox.information(self, "Report", textMsg)
            textMsg += "\r\nReport-Verzeichnis öffnen?\r\n"
            msgBox = QMessageBox.StandardButton.Yes
            msgBox |= QMessageBox.StandardButton.No
            if QMessageBox.question(self, "Report", textMsg, msgBox) == QMessageBox.Yes:
                os.startfile(self.HlineOutputfiles.getText())

        else:
            QMessageBox.warning(self, "Achtung", "Keine Datei selektiert!")
            pass
class AnimMungeDialog(QDialog):
    types = ['FirstPerson/Soldier',
            'Prop/Vehicle']
    types2 = {'FirstPerson/Soldier': '/comp_debug 0 /debug',
                'Prop/Vehicle': '/specialquathack'}

    def __init__(self, files, main, parent=None):
        super(AnimMungeDialog, self).__init__(parent)
        self.outd = os.getcwd() + '\\munge\\output'
        self.ind = os.getcwd() + '\\munge\\input'
        self.files = files
        self.clear_input_files()
        self.clear_output_files()
        for filename in self.files:
            shutil.copy(filename, self.ind)
        self.initUI()

    def munge(self):
        self.statlabel.setText('<b>AnimMunging</b>')
        params = self.types2[self.type_box.currentText()]
        add_params = ''
        if self.add_params.text() != 'Additional Params':
            add_params = ' {0}'.format(self.add_params.text())
        if self.bf1mode.isChecked():
            os.system(os.getcwd() + '\\zenasset1.exe /multimsh /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
            os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}\\'.format(self.outd, self.outd))
            os.system(os.getcwd() + '\\binmunge1.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}\\'.format(self.outd, self.outd))
        else:
            os.system(os.getcwd() + '\\zenasset.exe /multimsh /writefiles /src {0}{1} /keepframe0 {2} /dest {3}\\{4}.zaf'.format(self.ind, add_params, params, self.outd, self.animname.text()))
            os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaa -chunkid zaa_ -ext zaabin -outputdir {1}'.format(self.outd, self.outd))
            os.system(os.getcwd() + '\\binmunge.exe -inputfile munge\\output\\*.zaf -chunkid zaf_ -ext zafbin -outputdir {1}'.format(self.outd, self.outd))
        self.clear_byproduct()
        files = []
        for filename in os.listdir(self.outd):
            files.append(filename)
        self.outfiles.addItems(files)
        self.statlabel.setText('<b>AnimMunged</b>')

    def initUI(self):
        grp = QGroupBox('Anim Munge')
        grplay = QGridLayout()
        self.bf1mode = QCheckBox()
        grplay.addWidget(QLabel('<b>SWBF1</b>'), 0, 1)
        grplay.addWidget(self.bf1mode, 0, 2)
        grplay.addWidget(QLabel('<b>Input</b>'), 1, 1)
        grplay.addWidget(QLabel('<b>Output</b>'), 1, 3)
        self.infiles = QListWidget()
        self.infiles.setMinimumWidth(150)
        self.infiles.addItems([os.path.basename(item) for item in self.files])
        grplay.addWidget(self.infiles, 2, 1, 1, 2)
        self.outfiles = QListWidget()
        self.outfiles.setMinimumWidth(150)
        grplay.addWidget(self.outfiles, 2, 3, 1, 2)
        self.add_params = QLineEdit()
        self.add_params.setText('Additional Params')
        self.add_params.setToolTip('<b>Additional Munge Parameters.</b> Like scale 1.5')
        grplay.addWidget(self.add_params, 0, 3, 1, 2)

        self.statlabel = QLabel('<b>AnimMunger</b>')
        grplay.addWidget(self.statlabel, 4, 1, 1, 1)
        self.animname = QLineEdit()
        self.animname.setText('AnimName')
        self.animname.setToolTip('<b>Animation Name.</b> Name of the final animation files. IE: name.zafbin, name.zaabin, name.anims.')
        grplay.addWidget(self.animname, 3, 1)
        self.type_box = QComboBox()
        self.type_box.addItems(self.types)
        self.type_box.setToolTip('<b>Munge Mode.</b> This switches munge parameters.')
        grplay.addWidget(QLabel('<b>Munge Mode:</b>'), 3, 2)
        grplay.addWidget(self.type_box, 3, 3, 1, 2)
        munge_btn = QPushButton('Munge')
        munge_btn.clicked.connect(self.munge)
        munge_btn.setToolTip('<b>Munge.</b> Munges the input files with the selected mode.')
        grplay.addWidget(munge_btn, 4, 2)
        save_out = QPushButton('Save')
        save_out.clicked.connect(self.save)
        save_out.setToolTip('<b>Save.</b> Saves the output files.')
        grplay.addWidget(save_out, 4, 3)
        cancel_btn = QPushButton('Cancel')
        cancel_btn.clicked.connect(self.cancel)
        cancel_btn.setToolTip('<b>Cancel.</b> Closes the dialog and removes all temporary files.')
        grplay.addWidget(cancel_btn, 4, 4)

        grp.setLayout(grplay)

        mainlay = QVBoxLayout()
        mainlay.addWidget(grp)

        self.setLayout(mainlay)
        self.setGeometry(340, 340, 320, 300)
        self.setWindowTitle('MSH Suite - Animation Munge')
        self.show()

    def save(self):
        filepath = QFileDialog.getExistingDirectory(self, 'Select .MSH', os.getcwd())
        for filename in os.listdir(self.outd):
            shutil.copy(os.path.join(self.outd, filename), filepath)
        self.cancel()

    def cancel(self):
        self.statlabel.setText('<b>AnimSeeYa</b>')
        self.clear_input_files()
        self.clear_output_files()
        self.close()

    def clear_byproduct(self):
        for filename in os.listdir(self.outd):
            if filename.split('.')[-1] in ('zaa', 'zaf'):
                os.unlink(os.path.join(self.outd, filename))

    def clear_output_files(self):
        for filename in os.listdir(self.outd):
            filepath = os.path.join(self.outd, filename)
            try:
                if os.path.isfile(filepath):
                    os.unlink(filepath)
            except Exception, e:
                print e