def init_buttons(self): self.previous_img_button = QPushButton("上一张图片", self) self.next_img_button = QPushButton("下一张图片", self) self.save_message_button = QPushButton("保存当前图片信息", self) self.show_message_button = QPushButton("显示当前图片信息", self) self.open_folder_button = QPushButton("打开文件夹", self) self.add_border_button = QPushButton("保存当前框", self) self.delete_border_button = QPushButton("删除选中框", self) self.img_folder_text = QLineEdit('data', self) self.goto_chosen_img_button = QPushButton("跳转图片", self) self.jump_img_text = QLineEdit('', self) self.show_index_message = QLabel(self) self.crop_message_box = QCheckBox('裁剪所选图片', self) self.img_folder_text.selectAll() self.img_folder_text.setFocus() self.previous_img_button.setGeometry(30, 530, 150, 40) self.next_img_button.setGeometry(200, 530, 150, 40) self.save_message_button.setGeometry(370, 530, 150, 40) self.show_message_button.setGeometry(540, 530, 150, 40) self.img_folder_text.setGeometry(30, 590, 660, 40) self.open_folder_button.setGeometry(710, 590, 150, 40) self.jump_img_text.setGeometry(30, 650, 150, 40) self.goto_chosen_img_button.setGeometry(200, 650, 150, 40) self.show_index_message.setGeometry(30, 710, 300, 40) self.crop_message_box.setGeometry(30, 750, 150, 40) self.add_border_button.setGeometry(710, 380, 150, 40) self.delete_border_button.setGeometry(710, 440, 150, 40) self.previous_img_button.clicked.connect(self.previous_img) self.next_img_button.clicked.connect(self.next_img) self.save_message_button.clicked.connect(self.save_message) self.show_message_button.clicked.connect(self.show_message) self.open_folder_button.clicked.connect(self.open_folder) self.add_border_button.clicked.connect(self.save_current_border) self.delete_border_button.clicked.connect(self.delete_border) self.goto_chosen_img_button.clicked.connect(self.goto_chosen_img) self.crop_message_box.stateChanged.connect(self.crop_message) self.label_combo = QComboBox(self) for i in range(len(LABEL_LIST)): self.label_combo.addItem(LABEL_LIST[i]) self.label_combo.move(900, 30) self.label_combo.activated[str].connect(self.label_on_activated) self.listview = QListView(self) self.listview.setGeometry(710, 30, 150, 320) self.listview.doubleClicked.connect(self.list_clicked) self.listview.setEditTriggers(QListView.NoEditTriggers)
def __init__(self): super(CoursePage, self).__init__() # self.init_ui(self) self.setupUi(self) course_title = ['Developing Applications for Mobile and Social Media', 'Introduction to Business Data Analytics', 'Introduction to Entrepreneurship and Innovation', 'Introduction to Entrepreneurship and Innovation ', 'e-Customer Behaviours and Web Analytics' , 'Business Systems Design and Analysis', 'Introduction to Entrepreneurship and Innovation'] course_code=['EBIS 3093', 'EBIS 3103', 'GDBM 1013', 'GDBM 1013', 'EBIS 3083','EBIS 3013','GDBM 1013'] course_session = ['1001','1001','1001','1002','1001','1001','1008'] cname = [] for i in range(0,len(course_title)): cname.append(course_code[i]+"#"+course_title[i]+"#"+course_session[i]) # print(cname[i]) self.setWindowTitle("Course Page") course_name = [] for i in range(0,len(course_title)): course_name.append(course_title[i]+" ( " +course_session[i]+" ) ") # print(course_code) # print(course_name) self._cnamelist = cname slm = QStringListModel() self.listView.qList = course_name slm.setStringList(course_name) self.listView.setModel(slm) listView = QListView() listView.setModel(slm) self.listView.clicked.connect(self.CourseItemClicked) self.addCourse.clicked.connect(self.addCourse_btn_click) self.deleteCourse.clicked.connect(self.deleteCourse_btn_click) self.logOut.clicked.connect(self.logOut_btn_click)
def __init__(self, parent=None): super(ListViewDemo, self).__init__(parent) self.setWindowTitle("QListView 例子") self.resize(300, 270) layout = QVBoxLayout() listView = QListView() #创建一个listview对象 slm = QStringListModel(); #创建mode self.qList = ['Item 1','Item 2','Item 3','Item 4' ] #添加的数组数据 slm.setStringList(self.qList) #将数据设置到model listView.setModel(slm )##绑定 listView 和 model listView.clicked.connect(self.clickedlist) #listview 的点击事件 layout.addWidget( listView )#将list view添加到layout self.setLayout(layout) #将lay 添加到窗口
def create_universeList_panel(self): """ create the panel with a qlistview to display universes list Called only once on MainWindow creation """ self.toolbar.addSeparator() model = UniversesModel(self) self.list_model = model self.list_view = QListView() self.list_view.setModel(model) self.toolbar.addWidget(self.list_view) self.ola.universesList.connect(self.list_model.layoutChanged.emit) # Universe Selected Change self.list_view.selectionModel().selectionChanged.connect(self.universe_selection_changed)
def __init__(self, parent=None): super(ListViewDemo, self).__init__(parent) self.setWindowTitle("QListView 例子") self.resize(300, 270) layout = QVBoxLayout() listView = QListView() slm = QStringListModel() self.qList = ['Item1', 'Item2', 'Item3', 'Item4'] slm.setStringList(self.qList) listView.setModel(slm) listView.clicked.connect(self.clicked) layout.addWidget(listView) self.setLayout(layout)
def init_items(self): self.model = QStandardItemModel() for table in self.tables: item = QStandardItem(table) item.setCheckState(0) if item.text() in self.selected_items: item.setCheckState(2) item.setCheckable(True) self.model.appendRow(item) view = QListView() view.setModel(self.model) return view
def __init__(self, parent: QObject, image_cache: ImageCache): super().__init__(parent) self._image_cache = image_cache self._model = AbstractItemListModel(self, image_cache, True) self._item_delegate = ItemDelegate(self) self._list_view = QListView(self) self._list_view.setItemDelegate(self._item_delegate) self._layout_manager = QVBoxLayout(self) self._layout_ui()
def __init__(self, app): self.listViewModel = QStandardItemModel() self.app = app self.listView = QListView(app) self.listView.move(15, 145) self.listView.setFixedSize(app.width - 30, app.height - 190) self.listView.setModel(self.listViewModel) self.listView.setEditTriggers(QAbstractItemView.NoEditTriggers) self.listView.doubleClicked.connect(self.processItem) self.listView.keyPressEvent = self.keyPressEvent self.listView.selectionModel().selectionChanged.connect( self.selectionChanged)
def initWindow(self, hlabel): history_list = hlabel list_view = QListView(self) # 리스트뷰 생성 model = QStandardItemModel() # 리스트 뷰에 들어갈 모델 생성 for h in history_list: model.appendRow(QStandardItem(h)) # 모델에 한 줄 씩 추가 list_view.setModel(model) # 리스트 뷰에 모델 얹기 list_view.resize(500, 500) self.setWindowTitle(self.title) # 창 제목 세팅 self.setGeometry(500, 250, 500, 500) self.show()
def __init__(self): super().__init__() self.setWindowFlags(Qt.WindowCloseButtonHint | Qt.WindowTitleHint) self.setWindowTitle('List Manager') self.setFixedSize(400, 300) self.ListViewer = QListView() self.ListViewer.clicked.connect(self.ClickList) self.ListViewer.doubleClicked.connect(self.Ok) self.OkButton = QPushButton('OK') self.OkButton.clicked.connect(self.Ok) self.CancelButton = QPushButton('Cancel') self.CancelButton.clicked.connect(self.Cancel) sortorderlable = QLabel('Sort Order') self.SortOrder = [QRadioButton("Asc"), QRadioButton("Desc")] self.OrderGroup = QButtonGroup() sortalglable = QLabel('Sort Algorithm') self.SortAlg = [QRadioButton("Path"), QRadioButton("Natural")] self.AlgGroup = QButtonGroup() hbox1 = QHBoxLayout() hbox2 = QHBoxLayout() vbox1 = QVBoxLayout() vbox2 = QVBoxLayout() vbox3 = QVBoxLayout() mainbox = QVBoxLayout() vbox1.addWidget(sortorderlable) for i in range(len(self.SortOrder)): vbox1.addWidget(self.SortOrder[i]) self.OrderGroup.addButton(self.SortOrder[i], i) self.SortOrder[i].clicked.connect(self.ClickRadioButton) vbox2.addWidget(sortalglable) for i in range(len(self.SortAlg)): vbox2.addWidget(self.SortAlg[i]) self.AlgGroup.addButton(self.SortAlg[i], i) self.SortAlg[i].clicked.connect(self.ClickRadioButton) vbox3.addLayout(vbox1) vbox3.addLayout(vbox2) vbox3.addStretch(1) hbox1.addWidget(self.ListViewer) hbox1.addLayout(vbox3) hbox2.addStretch(1) hbox2.addWidget(self.OkButton) hbox2.addWidget(self.CancelButton) mainbox.addLayout(hbox1) mainbox.addLayout(hbox2) self.setLayout(mainbox) self.list = [] self.path = ''
def setup(self): '''Setup the cheat sheet viewing ''' self.display = QTextEdit(self) self.display.setFont(self.font) self.display.setSizePolicy(self.size_policy, self.size_policy) # self.display.setReadOnly(True) self.options = QListView(self) self.options.setFont(self.font) self.options.setSizePolicy(self.size_policy, self.size_policy) self.options.setEditTriggers(QAbstractItemView.NoEditTriggers) self.save = QPushButton('Update', self) self.save.setFont(self.font) self.save.setSizePolicy(self.size_policy, self.size_policy) self.save.clicked.connect(self.save_info) self.save.setEnabled(False) layout = QGridLayout(self) layout.addWidget(self.options, 0, 0) layout.addWidget(self.display, 0, 1) layout.addWidget(self.save, 1, 0) self.setLayout(layout) #get the different topics from cheat_sheet_topics.txt c = open( os.path.join( os.path.join(self.base_directory, 'Customer_Information'), 'Customers.txt'), 'r') c_data = c.readlines() c.close() if len(c_data) == 0: replay = QMessageBox.information( self, 'No Customers', 'There are currently no customers', QMessageBox.Ok) if replay == QMessageBox.Ok: self.close() else: self.topics = [] for i in c_data: self.topics.append(i.replace('\n', '')) self.entry = QStandardItemModel() self.options.setModel(self.entry) self.options.doubleClicked[QModelIndex].connect(self.openFile) for tex in self.topics: self.entry.appendRow(QStandardItem(tex)) self.show()
def createMainView(self): qhBox = QHBoxLayout() qhBox2 = QHBoxLayout() qvBox = QVBoxLayout() self.dirModel = QFileSystemModel() self.dirModel.setRootPath('') self.fileModel = QFileSystemModel() self.tree = QTreeView() self.list = QListView() self.tree.setModel(self.dirModel) self.list.setModel(self.fileModel) self.tree.clicked.connect(self.tree_on_clicked) self.list.clicked.connect(self.list_on_clicked) self.mainTextArea = QTextEdit() self.offsetTextArea = QTextEdit() self.asciiTextArea = QTextEdit() # Initialize them all to read only. self.mainTextArea.setReadOnly(True) self.asciiTextArea.setReadOnly(True) self.offsetTextArea.setReadOnly(True) # Create the fonts and styles to be used and then apply them. font = QFont("DejaVu Sans Mono", 11, QFont.Normal, True) self.mainTextArea.setFont(font) self.asciiTextArea.setFont(font) self.offsetTextArea.setFont(font) #self.offsetTextArea.setTextColor(Qt.red) # Syncing scrolls. syncScrolls(self.mainTextArea, self.asciiTextArea, self.offsetTextArea) # Highlight linking. BUG-GY self.mainTextArea.selectionChanged.connect(self.highlightMain) self.asciiTextArea.selectionChanged.connect(self.highlightAscii) qhBox.addWidget(self.offsetTextArea, 1) qhBox.addWidget(self.mainTextArea, 6) qhBox.addWidget(self.asciiTextArea, 2) qhBox2.addWidget(self.tree) qhBox2.addWidget(self.list) qvBox.addLayout(qhBox2) qvBox.addLayout(qhBox) return qvBox
def initSearchPane(self): """This pane is a QWidget that contains widget to search for existing cases""" self.m_searchpane = QWidget() layout1 = QVBoxLayout() taglist = self.m_base.getTagList() self.m_combobox1 = self.CreateTagCombobox(taglist) self.m_combobox2 = self.CreateTagCombobox(taglist) self.m_combobox3 = self.CreateTagCombobox(taglist) self.m_filelistview2 = QListView() self.m_filelistview2.setMinimumHeight(200) self.m_filelistview2.setModel(self.m_base.m_model) self.m_search_in_filequery = QLineEdit() searchboxescontainerwidget = QWidget() searchboxescontainerwidget.setMaximumWidth(300) layout_searchboxes = QVBoxLayout() layout_searchboxes.addWidget(self.m_search_in_filequery) layout_searchboxes.addWidget(self.m_combobox1) layout_searchboxes.addWidget(self.m_combobox2) layout_searchboxes.addWidget(self.m_combobox3) searchboxescontainerwidget.setLayout(layout_searchboxes) bottomWidget = QWidget() layout2 = QHBoxLayout() layout2.addWidget(searchboxescontainerwidget) layout2.addWidget(self.m_filelistview2) bottomWidget.setLayout(layout2) layout1.addWidget( self.CreateTitle("Search existing", self.m_searchpane)) layout1.addWidget(bottomWidget) layout1.setAlignment(Qt.AlignTop) self.m_searchpane.setLayout(layout1) #Connect signals self.m_combobox1.currentIndexChanged[str].connect( self.UpdateFileListView) self.m_combobox2.currentIndexChanged[str].connect( self.UpdateFileListView) self.m_combobox3.currentIndexChanged[str].connect( self.UpdateFileListView) self.m_search_in_filequery.textChanged.connect(self.UpdateFileListView) self.m_filelistview2.clicked.connect(self.FileIsSelected) self.m_filelistview2.clicked.connect(self.SwitchToEditView) self.SwitchToEditView() return self.m_searchpane
def match_from_submitted(self): """ This method will be called when match faces button is pressed. It download all data from firebase which has been submitted by user and runs KNN classifier on it in prediction mode. Any match above 50% threshold is shown here. """ result = match_faces.match() if result == []: QMessageBox.about(self, "No Match Till Now", "Please Pray") else: list = QListView(self) list.setIconSize(QSize(72, 72)) list.setMinimumSize(400, 380) model = QStandardItemModel(list) item = QStandardItem("Found") model.appendRow(item) for person in result: label, image, location = person label_ = str(label[0][0]).split('@') name = label_[0] mobile = label_[1] father_name = label_[2] age = label_[3] self.confirm(label, location, image) if len(name.split('*')) == 2: name = name.split('*')[0] + " " + name.split('*')[1] if len(father_name.split('*')) == 2: father_name = father_name.split('*')[0] + " " + father_name.split('*')[1] # nopep8 item = QStandardItem(" Name : " + name + "\n Father's Name : " + father_name + "\n Age : " + age + "\n Mobile : " + mobile + "\n Location : " + location) image = QtGui.QImage(image, image.shape[1], image.shape[0], image.shape[1] * 3, QtGui.QImage.Format_RGB888) icon = QPixmap(image) item.setIcon(QIcon(icon)) model.appendRow(item) list.setModel(model) list.show()
def __init__(self, controllore_prenotazione, parent=None): super(VistaPrenotazione, self).__init__(parent) self.controllore_prenotazione = controllore_prenotazione self.font_label = QFont("Arial", 14) self.v_layout = QVBoxLayout() # labels self.create_label( "Email: ", self.controllore_prenotazione.get_email_prenotazione()) self.create_label( "Periodo: ", self.controllore_prenotazione.get_data_inizio_prenotazione( ).strftime('%d/%m/%Y') + " - " + self.controllore_prenotazione. get_data_fine_prenotazione().strftime('%d/%m/%Y')) self.create_label( "Servizio ristorazione: ", self.controllore_prenotazione.get_servizio_ristorazione().nome) self.create_label( "Servizio alloggio: ", self.controllore_prenotazione.get_servizio_alloggio().nome) self.create_label( "Numero di persone: ", str(self.controllore_prenotazione.get_numero_persone())) self.create_label( "Codice ombrellone: ", self.controllore_prenotazione.get_codice_ombrellone()) self.create_label( "Prezzo totale: ", str(self.controllore_prenotazione.get_prezzo_totale()) + ' €') # label servizi aggiuntivi self.label_servizi_aggiuntivi = QLabel("Servizi aggiuntivi:") self.label_servizi_aggiuntivi.setStyleSheet( "color: rgb(0, 0, 0);\n" "font: 300 18pt \"Times New Roman\";\n" "background-color: rgba(178, 225, 255, 20);") self.v_layout.addWidget(self.label_servizi_aggiuntivi) self.v_layout.addSpacing(20) # lista servizi aggiuntivi self.lista_servizi_aggiuntivi = QListView() self.get_dati_lista_servizi() self.v_layout.addWidget(self.lista_servizi_aggiuntivi) self.setLayout(self.v_layout) self.setWindowTitle("Prenotazione") self.resize(800, 500)
def initUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.model = QFileSystemModel() self.model.setRootPath(QDir.currentPath()) self.model.setFilter(QDir.AllDirs | QDir.NoDot | QDir.Files) self.model.setNameFilterDisables(False) self.model.setNameFilters(["*.ngc", '*.py']) self.list = QListView() self.list.setModel(self.model) self.updateDirectoryView(self.default_path) self.list.setWindowTitle("Dir View") self.list.resize(640, 480) self.list.clicked[QModelIndex].connect(self.clicked) self.list.activated.connect(self._getPathActivated) #self.list.currentChanged = self.currentChanged self.list.setAlternatingRowColors(True) self.cb = QComboBox() self.cb.currentTextChanged.connect(self.filterChanged) self.cb.addItems(sorted({'*.ngc', '*.py', '*'})) #self.cb.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.button = QPushButton() self.button.setText('Media') self.button.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.button.setToolTip('Jump to Media directory') self.button.clicked.connect(self.onMediaClicked) self.button2 = QPushButton() self.button2.setText('User') self.button2.setSizePolicy( QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.button2.setToolTip('Jump to linuxcnc directory') self.button2.clicked.connect(self.onUserClicked) hbox = QHBoxLayout() hbox.addWidget(self.button) hbox.addWidget(self.button2) hbox.addWidget(self.cb) windowLayout = QVBoxLayout() windowLayout.addWidget(self.list) windowLayout.addLayout(hbox) self.setLayout(windowLayout) self.show()
def initUI(self): global species species = QStringListModel() speciesList = [] all_species = Category.select() for x in all_species: speciesList.append(x.name) speciesList.append("Add New") species.setStringList(speciesList) prefered_image_width = (0.485 * app.primaryScreen().size().width()) / 4 self.tab1 = GridWidget(DetectionKind.ActiveDetection, prefered_image_width, num_cols=3, labeler=True) self.tab2 = GridWidget(DetectionKind.UserDetection, prefered_image_width) self.tab3 = GridWidget(DetectionKind.ModelDetection, prefered_image_width) self.tab4 = QWidget() self.setWindowTitle('Labeler') self.addTab(self.tab1, "Unlabeled") # ("+str(len(self.unlabeled))+")") self.addTab(self.tab2, "User Labeled") # ("+str(len(self.labeled))+")") self.addTab(self.tab3, "Model Labeled") # ("+str(species.rowCount()-1)+")") self.addTab(self.tab4, "Species") # ("+str(species.rowCount()-1)+")") #print(self.tab1.parentWidget(),self) self.tab1.confirm = QPushButton('Confirm Images') self.tab1.start = QPushButton('Start Learning') self.tab1.horizontalLayout.addWidget(self.tab1.confirm) self.tab1.horizontalLayout.addWidget(self.tab1.start) self.tab4.verticalLayout = QVBoxLayout(self.tab4) self.tab4.speciesList = QListView() self.tab4.speciesList.setModel(species) self.tab4.speciesList.setRowHidden(len(species.stringList()) - 1, True) self.tab4.add = QPushButton('Add') self.tab4.update = QPushButton('Update') self.tab4.horizontalLayout = QHBoxLayout() self.tab4.horizontalLayout.addWidget(self.tab4.add) self.tab4.horizontalLayout.addWidget(self.tab4.update) self.tab4.verticalLayout.addWidget(self.tab4.speciesList) self.tab4.verticalLayout.addLayout(self.tab4.horizontalLayout) self.setWindowTitle('Labeler') self.tab1.confirm.clicked.connect(self.confirm) self.tab1.start.clicked.connect(self.active) self.tab4.add.clicked.connect(self.addSpecies) self.tab4.update.clicked.connect(self.updateSpecies)
def initUI(self): #GrBox1 GrBox = QGroupBox() vbox = QHBoxLayout(self) vbox.setContentsMargins(0, 0, 0, 0) #GrBox.setFixedHeight(60) pathButton = QPushButton(QIcon('icons\\pack.png'), "Папка") pathButton.setIconSize(QSize(25, 25)) pathButton.setVisible(True) pathLable = QLineEdit() #pathLable.setReadOnly(True) subPathCheck = QCheckBox() subPathCheck.setText("Подпапки") subPathCheck.setCheckState(0) vbox.addWidget(pathLable) vbox.addWidget(subPathCheck) vbox.addWidget(pathButton) GrBox.setLayout(vbox) #/GrBox1 #FilesTable FilesTable = QListView(self) FilesTable.setToolTip( "Список файлов, выберите нужные файлы для обработки,\nдля просмотра файла дважды щелкните по нему" ) FilesTableModel = QStandardItemModel() FilesTable.setModel(FilesTableModel) #/FilesTable #mainLayout mainLayout = QVBoxLayout() mainLayout.setContentsMargins(0, 0, 0, 0) mainLayout.setMenuBar(GrBox) mainLayout.addWidget(FilesTable) #/mainLayout #self self.setLayout(mainLayout) self.path = pathLable.text() self.pathLable = pathLable self.subPathCheck = subPathCheck self.FilesTableModel = FilesTableModel #/self #connections pathLable.textChanged.connect(self.setPath) pathButton.clicked.connect(self.selectPath) subPathCheck.clicked.connect(self.setPath) FilesTableModel.itemChanged.connect(self.ChangeFilesList) FilesTable.doubleClicked.connect(self.openFile)
def __init__(self, *args): QWidget.__init__(self, *args) # create objects list_data = [1, 2, 3, 4] lm = MyListModel(list_data, self) de = MyDelegate(self) lv = QListView() lv.setModel(lm) lv.setItemDelegate(de) # layout layout = QVBoxLayout() layout.addWidget(lv) self.setLayout(layout)
def __init__(self, parent = None): super().__init__(parent) self.showMaximized() self.Calendar() self.controller = ControlloreListaPrenotazioni() self.list_view = QListView() self.update_ui() self.h_layout = QHBoxLayout() from home.views.VistaHome import VistaHome self.setWindowTitle("Campo da {}".format(VistaHome().selezione_campo)) self.h_layout.addLayout(self.vbox) self.setLayout(self.h_layout) self.show()
def __init__(self): QWidget.__init__(self, flags=Qt.Widget) self.setWindowTitle("ItemView QListView") self.setFixedWidth(210) self.setFixedHeight(100) fruits = [ {"name": "banana", "color": "yellow", "bg_color": "yellow"}, {"name": "apple", "color": "red", "bg_color": "red"}, {"name": "pear", "color": "green", "bg_color": "gray"}, ] view = QListView(self) model = UserModel(fruits) view.setModel(model)
def __init__(self, *args, **kwargs): super(Window, self).__init__(*args, **kwargs) self.resize(600, 400) layout = QVBoxLayout(self) self.listView = QListView(self) self.listView.setEditTriggers(QListView.NoEditTriggers) layout.addWidget(self.listView) layout.addWidget(QPushButton('恢复默认顺序', self, clicked=self.restoreSort)) layout.addWidget(QPushButton('唐', self, clicked=self.sortByClassify)) layout.addWidget(QPushButton('宋', self, clicked=self.sortByClassify)) layout.addWidget(QPushButton('元', self, clicked=self.sortByClassify)) layout.addWidget(QPushButton('明', self, clicked=self.sortByClassify)) layout.addWidget(QPushButton('清', self, clicked=self.sortByClassify)) self._initItems()
def __init__(self, parent=None): super(VistaListaProdotti, self).__init__(parent) self.carrello = ControlloreCarrello() self.controller = ControlloreListaProdotti() self.setWindowIcon(QtGui.QIcon('logos/logo.png')) main_layout = QHBoxLayout() v_layout = QVBoxLayout() self.list_view = QListView() self.update_ui() #Crea un elenco fittizio sopra l'elenco reale per poter usare la barra di ricerca self.filter_proxy_model = QSortFilterProxyModel() self.filter_proxy_model.setSourceModel(self.listview_model) self.filter_proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) self.filter_proxy_model.setFilterKeyColumn(0) self.list_view.setModel(self.filter_proxy_model) search_field = QLineEdit() search_field.setStyleSheet('font-size: 15px; height: 30px;') search_field.textChanged.connect( self.filter_proxy_model.setFilterRegExp) v_layout.addWidget(search_field) v_layout.addWidget(self.list_view) main_layout.addLayout(v_layout) buttons_layout = QVBoxLayout() buttons_layout.addItem(QSpacerItem(40, 40)) #Bottone per aprire un prodotto open_button = QPushButton("Apri") open_button.clicked.connect(self.show_selected_info) buttons_layout.addWidget(open_button) #Bottone per creare un nuovo prodotto new_button = QPushButton("Nuovo") new_button.clicked.connect(self.show_new_prodotto) buttons_layout.addWidget(new_button) buttons_layout.addStretch() main_layout.addLayout(buttons_layout) self.setLayout(main_layout) self.resize(600, 300) self.setWindowTitle("Lista Prodotti")
def __init__(self): QMainWindow.__init__(self, flags=Qt.Window) # Set menu bar menu_bar = self.menuBar() file = menu_bar.addMenu("&File") new_action = QAction('&New Cluster', self, shortcut='Ctrl+N', triggered=self.new_cluster) exit_action = QAction('&Exit', self, shortcut='Alt+F4', triggered=self.close) file.addAction(new_action) file.addSeparator() file.addAction(exit_action) # Set core widgets self.conf_widget = QListView(self) self.conf_widget.setMinimumWidth(150) self.conf_widget.clicked.connect(self.load_cluster) self.context_widget = QTabWidget(self) self.context_widget.setMinimumWidth(100) central_widget = QSplitter(Qt.Horizontal, self) central_widget.addWidget(self.conf_widget) central_widget.addWidget(self.context_widget) central_widget.setCollapsible(0, False) central_widget.setCollapsible(1, False) central_widget.setSizes([150, 999]) self.setCentralWidget(central_widget) # Set UI self.setWindowIcon(QIcon(':/icons/fire_damage.ico')) self.setWindowTitle(WINDOW_TITLE) self.setMinimumSize(600, 400) # Set vars self.config_manager = ConfigurationManager() self.load_configuration() self.loaded_clusters = []
def __init__(self, user:str, parent=None): super(QWidget, self).__init__(parent) self.general_layout = QVBoxLayout() self.buttons_layout = QHBoxLayout() self.content_layout = QHBoxLayout() self.actions_buttons = { CentralWidgetParkingson.ADD_button_key: QPushButton('Anadir'), CentralWidgetParkingson.DELETE_button_key: QPushButton('Eliminar'), CentralWidgetParkingson.EDIT_button_key: QPushButton('Editar') } for x in self.actions_buttons: self.actions_buttons[x].setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.actions_buttons[x].setObjectName(x + "_button") self.buttons_layout.addWidget(self.actions_buttons[x]) self.buttons_layout.setAlignment(Qt.AlignLeft) self.buttons_layout.setSpacing(20) self.pacients_list_view = QListView() self.pacients_list_view.resize(200, 400) self.parent_tab_widget = QTabWidget() self.parent_tab_widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.pacients_tab: PacientWidget = PacientWidget() # Tab1 Color # self.rendimiento_tab = MplCanvas(self, width=5, height=4, dpi=100) # Tab2 Grafica self.evolution_tab = EvolutionTab(user) self.cronometro_tab = Cronometro(user) self.parent_tab_widget.resize(300, 300) # Tab Parent self.parent_tab_widget.addTab(self.pacients_tab, "Paciente") self.parent_tab_widget.addTab(self.evolution_tab, "Evolucion") self.parent_tab_widget.addTab(self.cronometro_tab, "Cronómetro") self.pacients_list_view.setMinimumSize(200, 400) self.pacients_list_view.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.pacients_list_view.setContextMenuPolicy(Qt.CustomContextMenu) self.content_layout.addWidget(self.pacients_list_view, stretch=3, alignment=Qt.AlignTop) self.content_layout.addWidget(self.parent_tab_widget, stretch=9) # self.general_layout.addLayout(self.buttons_layout) self.general_layout.addLayout(self.content_layout) self.setMinimumSize(900, 600) self.setLayout(self.general_layout)
def init(self): self.menus = QComboBox() self.menus.setView(QListView()) self.menus.setStyleSheet( "QComboBox QAbstractItemView::item {min-height: 25px;}") self.menus.addItem("编号") self.menus.addItem("书名") self.menus.addItem("作者") self.menus.setFixedSize(60, 40) self.select_mode = QButtonGroup() self.select_mode_strict = QRadioButton('严格搜索') self.select_mode_blurry = QRadioButton('模糊搜索') self.select_mode.addButton(self.select_mode_strict) self.select_mode.addButton(self.select_mode_blurry) self.select_mode_strict.setChecked(True) self.input_search = QLineEdit() self.btn_search_keyword = QPushButton("搜索") self.btn_clear_all = QPushButton("Clear") self.btn_add_book = QPushButton("添加图书") self.btn_clear_all.clicked.connect(self.clear_all) self.btn_search_keyword.clicked.connect(self.load_keyword_info) self.btn_add_book.clicked.connect(self.add_book) self.infos = QFrame() self.qsl = QStackedLayout(self.infos) self.search_result = book_search_result() self.book_add = book_add() self.qsl.addWidget(self.search_result) self.qsl.addWidget(self.book_add) menubar = QHBoxLayout() menubar.addWidget(self.menus) menubar.addWidget(self.input_search) menubar.addWidget(self.btn_search_keyword) menubar.addWidget(self.btn_clear_all) menubar.addWidget(self.btn_add_book) menubar.addWidget(self.select_mode_strict) menubar.addWidget(self.select_mode_blurry) layout = QVBoxLayout() layout.addLayout(menubar) layout.addWidget(self.infos) self.setLayout(layout)
def __init__(self, callback): super(VistaPrenotazioneAccount, self).__init__() # Attributi self.controller = ControllerSessione() self.callback = callback self.layout_verticale = QVBoxLayout() self.layout_orizzontale1 = QHBoxLayout() self.layout_orizzontale2 = QHBoxLayout() # Sfondo self.show_background("PRENOTAZIONI ACCOUNT") self.layout_orizzontale1.addSpacerItem( QSpacerItem(400, 0, QSizePolicy.Fixed, QSizePolicy.Fixed)) # label self.lista_prenotazioni = QListView() vista_lista_model = self.aggiorna() self.layout_orizzontale1.addWidget(vista_lista_model) self.layout_verticale.addLayout(self.layout_orizzontale1) # Spaziatura self.layout_orizzontale1.addSpacerItem( QSpacerItem(400, 0, QSizePolicy.Fixed, QSizePolicy.Fixed)) self.layout_verticale.addSpacerItem( QSpacerItem(0, 100, QSizePolicy.Fixed, QSizePolicy.Fixed)) self.layout_orizzontale2.addSpacerItem( QSpacerItem(700, 0, QSizePolicy.Fixed, QSizePolicy.Fixed)) # Pulsante indietro allineato pulsante_indietro = QPushButton("INDIETRO") pulsante_indietro.setFont(QFont('Times New Roman', 30)) pulsante_indietro.setFixedSize(400, 150) pulsante_indietro.clicked.connect(self.indietro) self.layout_orizzontale2.addWidget(pulsante_indietro) self.layout_orizzontale2.addSpacerItem( QSpacerItem(700, 0, QSizePolicy.Fixed, QSizePolicy.Fixed)) # Conclusione self.layout_verticale.addLayout(self.layout_orizzontale2) self.layout_verticale.addSpacerItem( QSpacerItem(0, 100, QSizePolicy.Expanding, QSizePolicy.Expanding)) self.setLayout(self.layout_verticale)
def __init__(self, host, port, parent=None): QDialog.__init__(self, parent) self.host = host self.port = port self._layout = QVBoxLayout(self) self.setWindowTitle("Hardware on " + self.host + ":" + str(self.port)) self.setMinimumSize(800, 600) self.hardware = None self.selectedHW = None self._model = None self._lbl_status = QLabel() self._layout.addWidget(self._lbl_status) self._layoutH = QHBoxLayout() self._layout.addLayout(self._layoutH) self._hwlist = QListView() self._layoutH.addWidget(self._hwlist) self._lbl_hw = QLabel() self._lbl_hw.setMinimumWidth(400) self._lbl_hw.setMargin(10) self._lbl_hw.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont)) #self._layoutH.addWidget(self._hwlabel) self._hwscroll = QScrollArea() self._hwscroll.setWidget(self._lbl_hw) self._layoutH.addWidget(self._hwscroll) self._layoutB = QHBoxLayout() self._layout.addLayout(self._layoutB) self._btn_select = QPushButton("Select") self._layoutB.addWidget(self._btn_select) self._btn_rescan = QPushButton("Rescan") self._layoutB.addWidget(self._btn_rescan) self._btn_cancel = QPushButton("Cancel") self._layoutB.addWidget(self._btn_cancel) self._btn_select.clicked.connect(self._select) self._btn_cancel.clicked.connect(lambda: (self._quitScan(), self.close())) self._btn_rescan.clicked.connect(self._prepareScan) self._disable() self._start()
def __init__( self, api: Api, model: AssStylesModel, selection_model: QItemSelectionModel, parent: QWidget, ) -> None: super().__init__(parent) self._api = api self._model = model selection_model.selectionChanged.connect(self._on_selection_change) self._styles_list_view = QListView(self) self._styles_list_view.setModel(model) self._styles_list_view.setSelectionModel(selection_model) self._add_button = QPushButton("Add", self) self._add_button.clicked.connect(self._on_add_button_click) self._remove_button = QPushButton("Remove", self) self._remove_button.setEnabled(False) self._remove_button.clicked.connect(self._on_remove_button_click) self._duplicate_button = QPushButton("Duplicate", self) self._duplicate_button.setEnabled(False) self._duplicate_button.clicked.connect(self._on_duplicate_button_click) self._move_up_button = QPushButton("Move up", self) self._move_up_button.setEnabled(False) self._move_up_button.clicked.connect(self._on_move_up_button_click) self._move_down_button = QPushButton("Move down", self) self._move_down_button.setEnabled(False) self._move_down_button.clicked.connect(self._on_move_down_button_click) self._rename_button = QPushButton("Rename", self) self._rename_button.setEnabled(False) self._rename_button.clicked.connect(self._on_rename_button_click) strip = QWidget(self) strip_layout = QGridLayout(strip) strip_layout.setContentsMargins(0, 0, 0, 0) strip_layout.addWidget(self._add_button, 0, 0) strip_layout.addWidget(self._remove_button, 0, 1) strip_layout.addWidget(self._duplicate_button, 0, 2) strip_layout.addWidget(self._move_up_button, 1, 0) strip_layout.addWidget(self._move_down_button, 1, 1) strip_layout.addWidget(self._rename_button, 1, 2) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self._styles_list_view) layout.addWidget(strip)
def initUI(self): self.setWindowTitle("QlistView例子") self.resize(300, 270) layout = QVBoxLayout() listview = QListView() listModel = QStringListModel() self.list = ['列表项1', '列表项2', '列表项3'] listModel.setStringList(self.list) listview.setModel(listModel) listview.clicked.connect(self.clicked) layout.addWidget(listview) self.setLayout(layout)