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, 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()
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 __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
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")
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 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)
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 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)
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')
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 )
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 )
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)
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"))
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()
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."))
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 = []
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 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))
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)
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)
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 )
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)
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)
def tab_options(self): """ Everything inside the Options tab gets created here. """ # self.options # This section is for selecting output dir # Creates the output dir label self.output_dir_lbl = QLabel(self.options) self.output_dir_lbl.setGeometry(10, 10, 125, 15) self.output_dir_lbl.setText('Change Output Directory: ') # Creates the output dir button self.select_output_dir_btn = QPushButton(self.options) self.select_output_dir_btn.setGeometry(137, 8, 30, 20) self.select_output_dir_btn.setText('...') # Creates the output dir currentdir Lineedit self.output_cur_dir_lbl = QLineEdit(self.options) self.output_cur_dir_lbl.setGeometry(170, 6, 210, 25) self.output_cur_dir_lbl.setReadOnly(True) self.output_cur_dir_lbl.setText( Constants.CONFIG.get('directories', 'current_song')) # when the '...' button is clicked, show a dialog (fire func # disp_dialog) QObject.connect(self.select_output_dir_btn, SIGNAL("clicked()"), self.disp_dialog) # This section is for selecting what players you use # The box with all the active players self.active_items_list = QListWidget(self.options) self.active_items_list.setGeometry(10, 40, 150, 100) # The box with all the inactive players self.inactive_items_list = QListWidget(self.options) self.inactive_items_list.setGeometry(230, 40, 150, 100) # Populate the two boxes with active and inactive items for item in Constants.ACTIVEITEMS: if item == '__name__' or item == 'active': continue self.active_items_list.addItem(item) for item in Constants.INACTIVEITEMS: if item == '__name__' or item == 'active': continue self.inactive_items_list.addItem(item) # The buttons responsible for switching # off button self.switch_active_item_button_off = QPushButton(self.options) self.switch_active_item_button_off.setText('->'.decode('utf-8')) # Makes the -> readable and clear self.switch_active_item_button_off.setFont(QFont('SansSerif', 17)) self.switch_active_item_button_off.setGeometry(175, 55, 40, 30) # on button self.switch_active_item_button_on = QPushButton(self.options) self.switch_active_item_button_on.setText('<-'.decode('utf-8')) # makes <- readable and clear self.switch_active_item_button_on.setFont(QFont('SansSerif', 17)) self.switch_active_item_button_on.setGeometry(175, 90, 40, 30) QObject.connect(self.switch_active_item_button_on, SIGNAL("clicked()"), self.switch_item_on) QObject.connect(self.switch_active_item_button_off, SIGNAL("clicked()"), self.switch_item_off) # A button to toggle the split output in half option. It's a temporary # fix for the Foobar double output problem. self.switch_output_split_btn = QCheckBox(self.options) self.switch_output_split_btn.setCheckState(Qt.CheckState.Unchecked) self.switch_output_split_btn.setGeometry(10, 140, 40, 30) self.switch_output_split_btn.stateChanged.connect(self.toggle_split) # The label for the split toggle self.switch_output_split_lbl = QLabel(self.options) self.switch_output_split_lbl.setText( "Split the output text in half (don't use this if you don't need it)" ) self.switch_output_split_lbl.setGeometry(30, 140, 300, 30)
def __init__(self): QMainWindow.__init__(self) self.resize(800, 600) self.setWindowTitle('PDF Merger') about = QAction('About', self) self.connect(about, SIGNAL('triggered()'), self.show_about) exit = QAction('Exit', self) exit.setShortcut('Ctrl+Q') self.connect(exit, SIGNAL('triggered()'), SLOT('close()')) self.statusBar() menubar = self.menuBar() file = menubar.addMenu('File') file.addAction(about) file.addAction(exit) self.main_widget = QWidget(self) self.setCentralWidget(self.main_widget) self.up_down_widget = QWidget(self) self.options_widget = QWidget(self) input_files_label = QLabel( "Input PDFs\nThis is the order in which the files will be merged too" ) self.files_list = QListWidget() self.files_list.setSelectionMode(QAbstractItemView.ExtendedSelection) add_button = QPushButton("Add PDF(s) to merge...") add_button.clicked.connect(self.clicked_add) up_button = QPushButton("Up") up_button.clicked.connect(self.move_file_up) down_button = QPushButton("Down") down_button.clicked.connect(self.move_file_down) remove_button = QPushButton("Remove PDF") remove_button.clicked.connect(self.remove_file) select_path_label = QLabel("Output PDF") self.dest_path_edit = QLineEdit() self.dest_path_edit.setReadOnly(True) select_path = QPushButton("Select...") select_path.clicked.connect(self.select_save_path) start = QPushButton("Start") start.clicked.connect(self.merge_pdf) up_down_vbox = QVBoxLayout(self.up_down_widget) up_down_vbox.addWidget(up_button) up_down_vbox.addWidget(down_button) up_down_vbox.addWidget(remove_button) self.up_down_widget.setLayout(up_down_vbox) group_input = QGroupBox() grid_input = QGridLayout() grid_input.addWidget(add_button, 0, 0) grid_input.addWidget(input_files_label, 1, 0) grid_input.addWidget(self.files_list, 2, 0) grid_input.addWidget(self.up_down_widget, 2, 1) group_input.setLayout(grid_input) group_output = QGroupBox() grid_output = QGridLayout() grid_output.addWidget(select_path_label, 0, 0) grid_output.addWidget(self.dest_path_edit, 1, 0) grid_output.addWidget(select_path, 1, 1) group_output.setLayout(grid_output) vbox_options = QVBoxLayout(self.options_widget) vbox_options.addWidget(group_input) vbox_options.addWidget(group_output) vbox_options.addWidget(start) self.options_widget.setLayout(vbox_options) splitter_filelist = QSplitter() splitter_filelist.setOrientation(Qt.Vertical) splitter_filelist.addWidget(self.options_widget) vbox_main = QVBoxLayout(self.main_widget) vbox_main.addWidget(splitter_filelist) vbox_main.setContentsMargins(0, 0, 0, 0)