Пример #1
0
 def _appendQuestion(self, q):
     print('q: ', q)
     item = QListWidgetItem()
     item.setText(q.text)
     item.setStatusTip(str(q.id))
     self.lstQuestions.addItem(item)
     session.add(q)
Пример #2
0
 def _finishAddQuestions(self, t):
     item = QListWidgetItem()
     item.setText(t.title)
     item.setStatusTip(str(t.id))
     self.lstTopics.addItem(item)
     session.commit()
     print('finished')
Пример #3
0
 def __toolbarComboBox_currentIndexChanged(self, index):
     """
     Private slot called upon a selection of the current toolbar.
     
     @param index index of the new current toolbar (integer)
     """
     itemID = self.toolbarComboBox.itemData(index)
     self.__currentToolBarItem = self.__toolbarItems[itemID]
     self.toolbarActionsList.clear()
     for actionID in self.__currentToolBarItem.actionIDs:
         item = QListWidgetItem(self.toolbarActionsList)
         if actionID is None:
             item.setText(self.__separatorText)
         else:
             action = self.__manager.actionById(actionID)
             item.setText(action.text())
             item.setIcon(action.icon())
             item.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter)
             item.setData(E5ToolBarDialog.ActionIdRole, int(id(action)))
             item.setData(E5ToolBarDialog.WidgetActionRole, False)
             if self.__manager.isWidgetAction(action):
                 item.setData(E5ToolBarDialog.WidgetActionRole, True)
                 item.setData(Qt.TextColorRole, QColor(Qt.blue))
     self.toolbarActionsList.setCurrentRow(0)
     
     self.__setupButtons()
Пример #4
0
    def createTabWindowStyle(self):
        self.tabWindowStyle = QWidget()
        self.tabWindowStyle.setObjectName("tabWindowStyle")

        self.verticalLayout_6 = QVBoxLayout(self.tabWindowStyle)
        self.verticalLayout_6.setObjectName("verticalLayout_6")

        self.listWidgetWindowStyle = QListWidget(self.tabWindowStyle)
        self.listWidgetWindowStyle.setResizeMode(QListView.Adjust)
        self.listWidgetWindowStyle.setIconSize(QSize(340, 105))
        self.listWidgetWindowStyle.setViewMode(QListView.IconMode)
        self.listWidgetWindowStyle.setObjectName("listWidgetWindowStyle")

        item = QListWidgetItem(self.listWidgetWindowStyle)
        icon = QIcon()
        icon.addPixmap(QPixmap(":/data/images/breeze-window.png"))
        item.setIcon(icon)
        item.setText("Breeze")
        item.setStyleText = "org.kde.breeze"
        item = QListWidgetItem(self.listWidgetWindowStyle)
        icon1 = QIcon()
        icon1.addPixmap(QPixmap(":/data/images/oxygen-window.png"))
        item.setIcon(icon1)
        item.setText("Oxygen")
        item.setStyleText = "org.kde.oxygen"

        self.verticalLayout_6.addWidget(self.listWidgetWindowStyle)

        self.addTab(self.tabWindowStyle, self.tr("Window Style"))
Пример #5
0
    def createTabColorScheme(self):
        self.tabColorScheme = QWidget()
        self.tabColorScheme.setObjectName("tabColorScheme")

        self.verticalLayout_2 = QVBoxLayout(self.tabColorScheme)
        self.verticalLayout_2.setObjectName("verticalLayout_2")

        self.listWidgetColorScheme = QListWidget(self.tabColorScheme)
        self.listWidgetColorScheme.setObjectName("listWidgetColorScheme")
        self.verticalLayout_2.addWidget(self.listWidgetColorScheme)

        self.previewWidgetColor = PreviewWidgetColor(self.tabColorScheme)
        self.verticalLayout_2.addWidget(self.previewWidgetColor)

        self.addTab(self.tabColorScheme, self.tr("Color Scheme"))

        color_list = os.listdir(self.colorSchemePath)
        color_list.sort()

        for color in color_list:
            item = QListWidgetItem(self.listWidgetColorScheme)
            item.setText(color.split(".")[0])
            item.colorSchemeName = color


        self.listWidgetColorScheme.itemClicked.connect(self.previewColorScheme)
Пример #6
0
 def loadList(self):
     self.__ob_list_main.clear()
     self.__ob_line_search.clear()
     for i in self.__socman.getDump():
         item = QListWidgetItem()
         item.setText(i.getTitle())
         item.setSizeHint(QSize(10, 30))
         self.__ob_list_main.addItem(item)
Пример #7
0
 def generate_hotkey_list(self):
     """Generate the hotkey list."""
     for option in self.model.options('Hotkeys'):
         if not option.startswith(';'):
             item = QListWidgetItem()
             item.setText(option)
             item.setData(Qt.UserRole, self.model.get('Hotkeys', option))
             self.ui.listWidget_hotkey.addItem(item)
Пример #8
0
    def add_exist(self, name, dir):
        self.exist_projects.append((name, dir))

        item = QListWidgetItem()
        item.setText(name)
        item.setData(self._PROJECT_DIR_ROLE, dir)
        item.setIcon(QIcon.fromTheme("package_games"))

        self.projects_list.addItem(item)
Пример #9
0
    def _setup(self, botlist):
        for b in botlist:
            self.botList[b] = b
            item = QListWidgetItem(b)
            item.setCheckState(False)
            item.setText(b)
            self.botListView.addItem(item)

        self.removeButton.clicked.connect(self.removeButtonPressed)
        self.compareButton.clicked.connect(self.compareButtonPressed)
Пример #10
0
 def handleBundleUpdate(self, _status, _data):
     self.__ui.lwBundleList.clear()
     self.__ui.leAssloudDir.setText(_status.rootdir)
     for bundle_name in _status.bundle:
         # 包列表
         item_bundle = QListWidgetItem()
         item_bundle.setData(Qt.UserRole,
                             bundle_name)  # 使用setData给items添加对应的uuid,之后控制方便
         item_bundle.setText(item_bundle.data(Qt.UserRole))
         self.__ui.lwBundleList.addItem(item_bundle)
Пример #11
0
 def loadImages(self):
     self.image_list.clear()
     for root, dir, files in os.walk(os.path.join(self.book.source_path, "images")):
         for file in files:
             filename = os.path.join(self.book.source_path, "images", Path(file).name)
             item = QListWidgetItem()
             item.setToolTip("Doubleclick image to insert into text")
             item.setText(Path(file).name)
             item.setData(1, filename)
             self.image_list.addItem(item)
Пример #12
0
 def on_plus_clicked(self):
     item = QListWidgetItem()
     name = getName(self.list)
     item.setText(name)
     item.setFlags(item.flags() | Qt.ItemIsEditable
                   | Qt.ItemIsUserCheckable)
     item.setCheckState(Qt.Unchecked)
     item.setWhatsThis(name)
     self.list.addItem(item)
     self.list.setCurrentItem(item)
Пример #13
0
 def initWaveList(self):
     self.wave_dict = {"小黄":["catH1.wav",0],"小黄骚":["catH2.wav",0], "小黄又骚":["catH3.wav",0], "小黄又又骚":["catH4.wav",0]
                      ,"煤球":["catM1.wav",0],"煤球骚":["catM2.wav",0], "煤球又骚":["catM3.wav",0]
                      ,"老公":["laog.wav",0], "老婆":["laop.wav",0]}
     
     for k in self.wave_dict:
         item = QListWidgetItem()
         item.setText(k)
         item.setData(Qt.UserRole, self.wave_dict[k])
         self.list_LW.addItem(item)
Пример #14
0
def pyq_addpyq(nick, id, send_time, counter, context, comments):
    newitem = QListWidgetItem()
    text = "%s %s %s\n" \
           "赞: %d\n\n" \
           "%s\n\n"%(nick, id, send_time, counter, context)
    if len(comments) > 0 and len(comments[0]) > 1:
        for nick, context in comments:
            text = text + "      %s : %s\n" % (nick, context)
    newitem.setText(text)
    ui.listWidget_pyq.insertItem(0, newitem)
Пример #15
0
    def update_list_record(self, depot: str):
        record_dir_file = HistoryRecordBrowser.enumerate_depot_record(depot)

        self.__list_record.clear()
        for record_path, record_file in record_dir_file:
            item = QListWidgetItem()
            item.setText(record_file)
            item.setData(QtCore.Qt.UserRole, path.join(record_path,
                                                       record_file))
            self.__list_record.addItem(item)
Пример #16
0
 def _copy_image(self, source_file, target_folder):
     shutil.copy(source_file, target_folder)
     file_name = os.path.basename(source_file)
     if file_name not in self.test_images:
         self.test_images.append(file_name)
         item = QListWidgetItem()
         item.setText(file_name)
         self.image_list.addItem(item)
     # 释放 semaphore
     self.sem.release()
Пример #17
0
 def __set_file_text(self, data):
     """
     Displayed in the chat of the user who sends a file
     """
     tab = self.set_data_to_correct_tab(data['type'])
     font = QFont()
     font.setStyle(QFont.StyleItalic)
     item = QListWidgetItem(tab.children()[0])
     item.setFont(font)
     item.setText("%s: Send file" % self.members[data['username']].username)
 def add_folder(self):
     dir_path = QFileDialog.getExistingDirectory(self, "Select the picture folder", "C:/")
     print(dir_path)
     if dir_path not in self.folder_list:
         self.folder_list.append(dir_path)
         dir_path_item=QListWidgetItem()
         dir_path_item.setText(dir_path)
         self.listWidget.addItem(dir_path_item)
         self.search_pic(dir_path)
         self.lblstatus.setText(str(self.pic_num)+" pictures selected.")
Пример #19
0
    def setChatroomFill(self,_chatroom):

        self.chatroom_num = 0
        for each in _chatroom:
            self.chatroom_num += 1
            #self.chatroomInfo[each['NickName']] = each['UserName']
            item = QListWidgetItem()
            str = each['NickName']
            item.setText(str)
            self.allGroupList.addItem(item)
Пример #20
0
    def addChatFriend(self, _NickName, _RemarkName):

        item = QListWidgetItem()
        str = _NickName
        if _RemarkName is not '':
            str += '[' + _RemarkName + ']'

        item.setText(str)

        self.listChatting.addItem(item)
Пример #21
0
 def handleUpdateBundleList(self, _status, _data):
     self.__ui.lwLocalBundleList.clear()
     self.__ui.lwLocalAssetList.clear()
     for k in _status.bundle_binary.keys():
         item = QListWidgetItem()
         item.setData(Qt.UserRole, k)
         item.setText(k)
         item.setSizeHint(QSize(0, 25))
         self.__ui.lwLocalBundleList.addItem(item)
     self.__ui.lwLocalBundleList.setCurrentRow(0)
Пример #22
0
 def set_prohibited_item(prohibited_item: QtWidgets.QListWidgetItem,
                         item_type: str) -> None:
     # add list item that user does not have permission to upload
     prohibited_item.setText(f'{each} ⚠️')
     prohibited_item.setForeground(QColor(255, 0, 0))
     prohibited_item.setToolTip(
         f'You do not have permission to upload this {item_type}')
     prohibited_item.setFlags(list_item.flags()
                              & ~QtCore.Qt.ItemIsUserCheckable)
     prohibited_item.setCheckState(QtCore.Qt.Unchecked)
Пример #23
0
 def _populateSoftwareList(self, listWidget):
     listWidget.setIconSize(QSize(16, 16))
     for name, softDict in self.softwareObjects.items():
         item = QListWidgetItem(listWidget)
         item.setText(softDict['title'])
         item.setIcon(
             QIcon(
                 os.path.join(
                     IMAGES_FOLDER,
                     softDict.get('icon_16x16', DEFAULT_ICON_16_PATH))))
Пример #24
0
    def _populateList(self):
        """Get the item selected in the tree, check that it is a folder,
        and try to find all files associated with it. The valid files
        are then added to the list view in order. The list itself can be
        reordered by the user.
        """
        self.listBox.clear()
        if self.sourceItem is None:
            self.sourceItem = self.mainGui.projView.getSelectedHandle()

        if self.sourceItem is None:
            return False

        nwItem = self.theProject.tree[self.sourceItem]
        if nwItem is None:
            return False

        if nwItem.itemType is not nwItemType.FILE:
            self.mainGui.makeAlert(
                self.tr(
                    "Element selected in the project tree must be a file."),
                nwAlert.ERROR)
            return False

        inDoc = NWDoc(self.theProject, self.sourceItem)
        theText = inDoc.readDocument()
        if theText is None:
            theText = ""
            return False

        spLevel = self.splitLevel.currentData()
        self.theProject.options.setValue("GuiDocSplit", "spLevel", spLevel)
        logger.debug("Scanning document '%s' for headings level <= %d",
                     self.sourceItem, spLevel)

        self.sourceText = theText.splitlines()
        for lineNo, aLine in enumerate(self.sourceText):

            onLine = -1
            if aLine.startswith("# ") and spLevel >= 1:
                onLine = lineNo
            elif aLine.startswith("## ") and spLevel >= 2:
                onLine = lineNo
            elif aLine.startswith("### ") and spLevel >= 3:
                onLine = lineNo
            elif aLine.startswith("#### ") and spLevel >= 4:
                onLine = lineNo

            if onLine >= 0:
                newItem = QListWidgetItem()
                newItem.setText(aLine.strip())
                newItem.setData(Qt.UserRole, onLine)
                self.listBox.addItem(newItem)

        return True
Пример #25
0
    def __init__(self, parent):
        super().__init__(parent)

        self.setTitle(_("Add Wallet"))
        self.setFinalPage(False)

        option_list = self.option_list = QListWidget()
        option_list.setIconSize(QSize(30, 30))
        option_list.setStyleSheet("""
            QListView::item:selected {
                background-color: #F5F8FA;
                color: black;
            }
        """)

        for entry in self._get_entries():
            list_item = QListWidgetItem()
            list_item.setSizeHint(QSize(40, 40))
            list_item.setIcon(read_QIcon(entry['icon_filename']))
            list_item.setText(entry['description'])
            list_item.setData(Qt.UserRole, entry)
            option_list.addItem(list_item)

        option_list.setMaximumWidth(400)
        option_list.setWordWrap(True)

        option_detail = self.optionDetail = QLabel()
        option_detail.setMinimumWidth(200)
        option_detail.setAlignment(Qt.AlignTop | Qt.AlignLeft)
        option_detail.setTextFormat(Qt.RichText)
        option_detail.setWordWrap(True)
        option_detail.setOpenExternalLinks(True)
        option_detail.setText(self._get_entry_detail())

        layout = QHBoxLayout()
        # It looks tidier with more separation between the list and the detail pane.
        layout.setSpacing(15)
        layout.addWidget(option_list)
        layout.addWidget(option_detail)
        self.setLayout(layout)

        def _on_current_row_changed(current_row):
            self.completeChanged.emit()

        def _on_item_selection_changed():
            self.completeChanged.emit()
            selected_items = self.option_list.selectedItems()
            if len(selected_items):
                entry = selected_items[0].data(Qt.UserRole)
                self.optionDetail.setText(self._get_entry_detail(entry))
            else:
                self.optionDetail.setText(self._get_entry_detail())

        option_list.currentRowChanged.connect(_on_current_row_changed)
        option_list.itemSelectionChanged.connect(_on_item_selection_changed)
Пример #26
0
    def insert_issues(self, new_issues_list):
        for issue in new_issues_list:
            issue_widget = QCustomWidget()
            issue_widget.set_issue_key(issue['key'], issue['link'])
            issue_widget.set_issue_title(issue['title'])
            issue_widget.set_time(
                issue['estimated'],
                issue['logged'],
                issue['remaining']
            )

            issue_widget.quick_log_btn.clicked.connect(
                partial(
                    self.controller.log_work_from_list,
                    issue['key']
                )
            )

            issue_widget.log_work_btn.clicked.connect(
                partial(
                    self.controller.open_time_log,
                    issue['key']
                )
            )

            issue_widget.open_pomodoro_btn.clicked.connect(
                partial(
                    self.controller.open_pomodoro_window,
                    issue['key'], issue['title']
                )
            )

            # add workflow statuses to dropdown
            possible_workflows = self.controller.get_possible_workflows(issue)

            issue_widget.set_workflow.addItems(possible_workflows)
            issue_widget.set_workflow.setCurrentIndex(0)
            issue_widget.set_workflow.activated[str].connect(
                partial(
                    self.controller.change_workflow,
                    issue['workflow'],
                    issue['issue_obj'],
                )
            )

            # add issue item to list
            issue_list_widget_item = QListWidgetItem()
            issue_list_widget_item.setText(issue['key'])
            issue_list_widget_item.setSizeHint(issue_widget.sizeHint())
            self.issue_list_widget.insertItem(issue['index'], issue_list_widget_item)
            self.issue_list_widget.setItemWidget(
                issue_list_widget_item, issue_widget
            )
        self.set_size_hint()
Пример #27
0
    def createIcons(self):

        # asdButton = QListWidgetItem(self.contentsWidget)

        vagrantButton = QListWidgetItem(self.contentsWidget)
        vagrantButton.setIcon(QIcon(':/images/settings.png'))
        vagrantButton.setText("Ayarlar")
        vagrantButton.setTextAlignment(Qt.AlignHCenter)
        vagrantButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        #
        # dbButton = QListWidgetItem(self.contentsWidget)
        # dbButton.setIcon(QIcon(':/images/database.png'))
        # dbButton.setText("Veritabanı")
        # dbButton.setTextAlignment(Qt.AlignHCenter)
        # dbButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        #
        # ldapButton = QListWidgetItem(self.contentsWidget)
        # ldapButton.setIcon(QIcon(':/images/ldap.png'))
        # ldapButton.setText("OpenLDAP")
        # ldapButton.setTextAlignment(Qt.AlignHCenter)
        # ldapButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        #
        # xmppButton = QListWidgetItem(self.contentsWidget)
        # xmppButton.setIcon(QIcon(':/images/ejabberd.png'))
        # xmppButton.setText("Ejabberd")
        # xmppButton.setTextAlignment(Qt.AlignHCenter)
        # xmppButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        liderButton = QListWidgetItem(self.contentsWidget)
        liderButton.setIcon(QIcon(':/images/liderahenk.png'))
        liderButton.setText("Lider")
        liderButton.setTextAlignment(Qt.AlignHCenter)
        liderButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        consoleButton = QListWidgetItem(self.contentsWidget)
        consoleButton.setIcon(QIcon(':/images/lider_console.png'))
        consoleButton.setText("Lider\nArayüz")
        consoleButton.setTextAlignment(Qt.AlignHCenter)
        consoleButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        ahenkButton = QListWidgetItem(self.contentsWidget)
        ahenkButton.setIcon(QIcon(':/images/ahenk.png'))
        ahenkButton.setText("Ahenk")
        ahenkButton.setTextAlignment(Qt.AlignHCenter)
        ahenkButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        logButton = QListWidgetItem(self.contentsWidget)
        logButton.setIcon(QIcon(':/images/log.png'))
        logButton.setText("Log")
        logButton.setTextAlignment(Qt.AlignHCenter)
        logButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
Пример #28
0
 def dialog_helper_init(self):
     self.check_all_button.clicked.connect(self.handle_check_all_clicked)
     self.check_none_button.clicked.connect(self.handle_check_none_clicked)
     for attr in self.get_attrs():
         it = QListWidgetItem()
         it.setText(attr)
         it.setData(Qt.UserRole, attr)
         it.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
         it.setCheckState(Qt.Checked if attr in
                          self.default_attrs else Qt.Unchecked)
         self.attr_list.addItem(it)
 def refresh_list(self):
     self.input.clear()
     if not self._parameter.ordering == InputListParameter.NotOrdered:
         self._value_cache.sort()
     if self._parameter.ordering == InputListParameter.DescendingOrder:
         self._value_cache.reverse()
     for opt in self._value_cache:
         item = QListWidgetItem()
         item.setText(str(opt))
         item.setFlags(item.flags() | Qt.ItemIsEditable)
         self.input.addItem(item)
 def load_materials(self):
     material_dict = self.materials.material_dict
     self.material_list_widget.clear()
     for name, material in material_dict.items():
         item = QListWidgetItem()
         item.setText(name)
         item.setData(Qt.UserRole + 1, material)
         self.material_list_widget.addItem(item)
     self.material_list_widget.sortItems(Qt.AscendingOrder)
     self.material_list_widget.setCurrentRow(0)
     self.load_material_data()
Пример #31
0
    def setParameters(self):
        # select these from the files
        self.clear()
        self.availableDataParameters = [key for key in self.datakeys]

        for key in self.availableDataParameters:
            item = QListWidgetItem()
            item.setText(key)
            item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
            item.setCheckState(QtCore.Qt.Checked)
            self.addItem(item)
Пример #32
0
 def add_ai(self, ai=None):
     if ai is None:
         ai = AI()
     idx = len(self.ais)
     self.ais.append(ai)
     title = ai.title
     if not title:
         title = "Untitled"
     item = QListWidgetItem(self)
     item.setText(title)
     self.update()
    def createArticles(self):
        # load articles from library
        # and add them to the list
        for article in library.SCIENTIFIC_ARTICLES:
            # list widget item with it's data
            item = QListWidgetItem()
            item.setText(article[0].strip())
            item.setData(Qt.UserRole, article[1].strip())

            # add the item to the list widget
            self.listWidget.addItem(item)
    def createArticles(self):
        # load articles from library
        # and add them to the list
        for article in library.SCIENTIFIC_ARTICLES:
            # list widget item with it's data
            item = QListWidgetItem()
            item.setText(article[0].strip())
            item.setData(Qt.UserRole, article[1].strip())

            # add the item to the list widget
            self.listWidget.addItem(item)
Пример #35
0
    def loadDataSource(self):
        names = []
        for i in os.listdir(r"./objectdatas"):
            names.append("./objectdatas" + "/" + i)

        for name in names:
            predItem = QListWidgetItem(self)
            predItem.setIcon(QIcon(name))
            predItem.setText(name[14:-4])
            #predItem.setTextAlignment(Qt.AlignHCenter)
            predItem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
Пример #36
0
 def selectTopic(self, item):
     self.btnRemoveT.setEnabled(True)
     _topic = item.text()
     topic = session.query(Topic).filter(Topic.title == _topic).first()
     questions = topic.questions.all()
     self.lstQuestions.clear()
     for q in questions:
         item = QListWidgetItem()
         item.setText(q.text)
         item.setStatusTip(str(q.id))
         self.lstQuestions.addItem(item)
Пример #37
0
    def add_tag(self, label_id, tagdata):
        item_widget = QListWidgetItem()
        item_widget.setText(tagdata['text'])
        item_widget.setFlags(item_widget.flags() | Qt.ItemIsEditable)
        self.structures_list.addItem(item_widget)

        tag_widget = TagWidget(str(label_id), tagdata['text'], tagdata['x'],
                               tagdata['y'])
        tag_widget.adjust_to_size(self.image_widget.image().size(), 0.015 / 2)

        self.image_widget.addWidget(tag_widget)
Пример #38
0
    def _make_regulators_list():
        t = QListWidget()

        for s in GenePresenter.get_instance().network.species:
            i = QListWidgetItem()
            i.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
            i.setCheckState(Qt.Unchecked)
            i.setText(s)
            t.addItem(i)

        return t
Пример #39
0
 def _addItem(self, iName, iCol, oName, nUse):
     newIcon = QPixmap(16, 16)
     newIcon.fill(QColor(*iCol))
     newItem = QListWidgetItem()
     newItem.setText("%s [%d]" % (iName, nUse))
     newItem.setIcon(QIcon(newIcon))
     newItem.setData(Qt.UserRole, len(self.colData))
     self.listBox.addItem(newItem)
     self.colData.append((iName, *iCol, oName))
     self.colCounts.append(nUse)
     return newItem
Пример #40
0
	def loadLabel(self):
		loc_dict = load_from_yaml(PATH_LOC)
		for loc in loc_dict['location']:
			self.ui.combo_location.addItem(loc['country']+' / '+loc['city'])

		for place in loc_dict['place']:
			item = QListWidgetItem()
			item.setFlags(item.flags() | Qt.ItemIsUserCheckable)
			item.setCheckState(Qt.Unchecked)
			item.setText(place)        	
			self.ui.list_location.addItem(item)
Пример #41
0
 def setSearchResults(self, results):
     results = sorted(results, key=lambda x: x[1], reverse=False)
     for r in results:
         newItem = QListWidgetItem()
         text = open("RobotsFiles/" + r[0], "r").read()
         newItem.setText(r[0] + " (letters: " + str(len(text)) +
                         ", lines: " + str(text.count("\n")) + ")")
         self.resultList.insertItem(0, newItem)
     self.resultList.setMinimumWidth(self.resultList.sizeHintForColumn(0))
     self.resultList.setMaximumWidth(
         self.resultList.sizeHintForColumn(0) + 20)
Пример #42
0
 def add2analysis(self):
     for item in self.listWidget_data.selectedItems():
         for data in self.Rawdata:
             if data.uid == item.data(
                     32) and data.uid not in self.getnalysislist():
                 if data.checkset() == True:
                     dataitem = QListWidgetItem(
                         parent=self.listWidget_analysis)
                     dataitem.setText(data.name)
                     dataitem.setData(32, data.uid)
                     self.listWidget_analysis.addItem(dataitem)
Пример #43
0
 def updateDataList(self):
     self.listWidget_data.clear()
     for data in self.Rawdata:
         dataitem = QListWidgetItem(parent=self.listWidget_data)
         dataitem.setText(data.name)
         dataitem.setData(32, data.uid)
         self.listWidget_data.addItem(dataitem)
         if data.checkset() is False:
             dataitem.setForeground(QtGui.QBrush(QtGui.QColor(255, 0, 0)))
         if data.checkset() is True:
             dataitem.setForeground(QtGui.QBrush(QtGui.QColor(0, 255, 0)))
Пример #44
0
 def __set_text_after_save_file(self, data, path):
     """
     Specifies the text after the file has been sent
     """
     tab = self.set_data_to_correct_tab(data['type'])
     font = QFont()
     font.setWeight(QFont.Bold)
     item = QListWidgetItem(tab.children()[0])
     item.setFont(font)
     message = "the file was saved on the following path: %s" % path
     item.setText("%s: %s" % (self.members[data['username']].username,
                              message))
Пример #45
0
    def __init__(self, parameter, parent=None):
        """Constructor

        .. versionadded:: 2.2

        :param parameter: A ListParameter object.
        :type parameter: ListParameter

        """
        super().__init__(parameter, parent)

        self._input = QListWidget()

        self._input.setSelectionMode(QAbstractItemView.MultiSelection)

        if self._parameter.maximum_item_count != \
                self._parameter.minimum_item_count:
            tool_tip = 'Select between %d and %d items' % (
                self._parameter.minimum_item_count,
                self._parameter.maximum_item_count)
        else:
            tool_tip = 'Select exactly %d items' % (
                       self._parameter.maximum_item_count)

        self._input.setToolTip(tool_tip)

        for opt in self._parameter.options_list:
            item = QListWidgetItem()
            item.setFlags(item.flags() | Qt.ItemIsEditable)
            item.setText(str(opt))
            self._input.addItem(item)
            if opt in self._parameter.value:
                item.setSelected(True)

        self.inner_input_layout.addWidget(self._input)

        # override self._input_layout arrangement to make the label at the top
        # reset the layout
        self.input_layout.setParent(None)
        self.help_layout.setParent(None)

        self.label.setParent(None)
        self.inner_input_layout.setParent(None)

        self.input_layout = QVBoxLayout()
        self.input_layout.setSpacing(0)

        # put element into layout
        self.input_layout.addWidget(self.label)
        self.input_layout.addLayout(self.inner_input_layout)

        self.main_layout.addLayout(self.input_layout)
        self.main_layout.addLayout(self.help_layout)
Пример #46
0
 def __onLineEdit(self):
     self.__ob_button_delete.hide()
     if len(self.__ob_line_search.text()):
         self.__ob_list_main.clear()
         for i in self.__socman.getDump():
             if self.__ob_line_search.text().upper() in i.getTitle().upper():
                 item = QListWidgetItem()
                 item.setText(i.getTitle())
                 item.setSizeHint(QSize(10, 30))
                 self.__ob_list_main.addItem(item)
     else:
         self.loadList()
Пример #47
0
 def send_file(self, main_window_instance):
     index_first_tab = main_window_instance.tab_widget.currentIndex()
     if index_first_tab != 0:
         file_text = QFileDialog().getOpenFileName()
         current_tab = main_window_instance.tab_widget.currentWidget()
         current_widget = current_tab.children()[0]
         font = QFont()
         font.setStyle(QFont.StyleItalic)
         item = QListWidgetItem(current_widget)
         item.setFont(font)
         item.setText("%s: %s" % (self.username, "Sending File..."))
         self.client.send(file_text, current_tab, is_file=True)
Пример #48
0
 def push_button_action(self, main_window_instance):
     line_text = main_window_instance.line_edit.text()
     current_tab = main_window_instance.tab_widget.currentWidget()
     current_widget = current_tab.children()[0]
     item = QListWidgetItem(current_widget)
     check_for_icon = Client.check_text(line_text)
     if check_for_icon is True:
         path = os.path.dirname(os.path.abspath(__file__))
         item.setIcon(QIcon(path + "/codebase/client/pictures/python.jpg"))
     item.setText("%s: %s" % (self.username, line_text))
     self.client.send(line_text, current_tab)
     main_window_instance.line_edit.clear()
 def set_element_list(self):
     self.ui.listWidget_elements.clear()
     for element in self.elements:
         element_name = element.name
         if not (element_name in self.element_name_dict):  # no element to that name yet
             element_wrapper = GraphicElementsWrapper(element)
             self.element_name_dict[element_name] = element_wrapper
             item = QListWidgetItem()
             item.setText(element_name)
             item.setData(Qt.UserRole + 2, element_wrapper)
             self.element_list_item_dict[element_name] = item
             self.ui.listWidget_elements.addItem(item)
     self.ui.listWidget_elements.sortItems(Qt.AscendingOrder)
Пример #50
0
    def createTabIconSet(self):
        self.tabIconSet = QWidget()
        self.tabIconSet.setObjectName("tabIconSet")

        self.verticalLayout_3 = QVBoxLayout(self.tabIconSet)
        self.verticalLayout_3.setObjectName("verticalLayout_3")

        self.listWidgetIconSet = QListWidget(self.tabIconSet)
        self.listWidgetIconSet.setResizeMode(QListView.Adjust)
        self.listWidgetIconSet.setObjectName("listWidgetIconSet")
        self.listWidgetIconSet.setViewMode(QListView.IconMode)
        self.listWidgetIconSet.setIconSize(QSize(370, 64))
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/midna-set.png"))
        item.setText("Midna")
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/midna-dark-set.png"))
        item.setText("MidnaDark")
        
        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/breeze-set.png"))
        item.setText("Breeze")

        item = QListWidgetItem(self.listWidgetIconSet)
        item.setIcon(QIcon(":/data/images/oxygen-set.png"))
        item.setText("Oxygen")

        self.verticalLayout_3.addWidget(self.listWidgetIconSet)

        self.addTab(self.tabIconSet, self.tr("Icon Set"))
Пример #51
0
 def onAddL(self):
     ''' Add new language.
     '''
     lang, ok = QInputDialog.getText(self, 'add language', 'Input language name')
     if ok and lang and lang.strip():
         if self.lstLangs.findItems(lang, Qt.MatchFixedString):
             QMessageBox.information(self, 'Error', '{} exists already.'.format(lang))
             return
         l = Language(name=lang)
         session.add(l)
         session.commit()
         item = QListWidgetItem()
         item.setText(l.name)
         item.setStatusTip(str(l.id))
         self.lstLangs.addItem(item)
Пример #52
0
 def selectLang(self, item):
     ''' show topics that are related with selected language.
     :param item: language
     :return: QListWidgetItem
     '''
     self.btnRemoveL.setEnabled(True)
     _lang = item.text()
     lang = session.query(Language).filter(Language.name == _lang).first()
     if not lang:
         return
     topics = lang.topics.all()
     self.lstTopics.clear()
     for topic in topics:
         item = QListWidgetItem()
         item.setText(topic.title)
         item.setStatusTip(str(topic.id))
         self.lstTopics.addItem(item)
     self.lstQuestions.clear()
Пример #53
0
    def addContact(self, contact):
        if not contact:
            self.ui.refreshButton.setEnabled(True)
            return

        status = ''
        if contact.status == Contact.STATUS_ONLINE:
            status = u'Online'
            status_color = 0x00aa00
        elif contact.status == Contact.STATUS_OFFLINE:
            status = u'Offline'
            status_color = 0xff0000
        elif contact.status == Contact.STATUS_AWAY:
            status = u'Away'
            status_color = 0xffad16
        else:
            status = u'Unknown'
            status_color = 0xaaaaaa

        if contact.status_msg:
            status += u' — %s' % contact.status_msg

        item = QListWidgetItem()
        item.setText('<h2>%s</h2><font color="#%06X">%s</font><br /><i>%s</i>' % (contact.name, status_color, status, contact.backend))
        item.setData(Qt.UserRole, contact)

        if contact.photos is NotLoaded:
            process = QtDo(self.weboob, lambda c: self.setPhoto(c, item))
            process.do('fillobj', contact, ['photos'], backends=contact.backend)
            self.photo_processes[contact.id] = process
        elif len(contact.photos) > 0:
            if not self.setPhoto(contact, item):
                photo = contact.photos.values()[0]
                process = QtDo(self.weboob, lambda p: self.setPhoto(contact, item))
                process.do('fillobj', photo, ['thumbnail_data'], backends=contact.backend)
                self.photo_processes[contact.id] = process

        for i in xrange(self.ui.contactList.count()):
            if self.ui.contactList.item(i).data(Qt.UserRole).status > contact.status:
                self.ui.contactList.insertItem(i, item)
                return

        self.ui.contactList.addItem(item)
Пример #54
0
    def user_playlist(self):
        self.listWidget.clear()
        r = server.getServer('user/playlists', {'token':session_lib.get_token()})
        playlists = r['payload']['playlists']
        self.listWidget.itemClicked.connect(self.playlist_changed)
        my_item2 = QListWidgetItem()
        my_item2.setText('Browse Music')
        my_item2.setIcon(QIcon("images/browse-music.png"))
        my_item2.setData(Qt.UserRole, 0)
        self.listWidget.addItem(my_item2)
        #http://stackoverflow.com/questions/13536839/qt-how-to-improve-my-contextmenu
        self.listWidget.setContextMenuPolicy(Qt.CustomContextMenu)
        self.listWidget.customContextMenuRequested.connect(self.handleContext)
        for p in playlists:
            my_item=QListWidgetItem()
            my_item.setText(p['name'])
            self.listWidget.addItem(my_item)

            myObject=str(p['id'])
            my_item.setIcon(QIcon("images/playlist-icon.png"))   
            my_item.setData(Qt.UserRole, myObject)
Пример #55
0
    def _makeItem(self, layer):
        isDefault = layer is self._layerSet.defaultLayer
        name = layer.name
        color = layer.color
        item = QListWidgetItem()
        item.setText(name)
        if color:
            pixmap = QPixmap(100, 100)
            # change color
            pixmap.fill(QColor.fromRgbF(*color))
            icon = QIcon(pixmap)
        else:
            icon = QIcon(":/resources/defaultColor.svg")
        item.setIcon(icon)

        if isDefault:
            font = item.font()
            font.setBold(True)
            item.setFont(font)

        item.setFlags(item.flags() | Qt.ItemIsEditable)

        return item;
Пример #56
0
    def initUI(self):
        
        # get list of timesheets from names of directories
        timesheets = list(file for file in os.listdir(datapath) 
                     if os.path.isdir(os.path.join(datapath, file)))
        
        if len(timesheets) == 0:
            self.none_message()
            self.reject()
            self.close()
            
        else:
            # make list where only one thing can be selected
            self.timesheetList = QListWidget()
#            self.timesheetList.setSelectionMode(QAbstractItemView.SingleSelection)
            # double click or 'OK' button select that timesheet
            self.timesheetList.itemDoubleClicked.connect(self.get_selected)
            
            listWidgetItems = []
            
            # set the text in the list
            for timesheet in timesheets:
                item = QListWidgetItem(self.timesheetList)
                item.setText(timesheet)
                listWidgetItems.append(item)
                
            buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | 
                                         QDialogButtonBox.Cancel)
    
            buttonBox.accepted.connect(self.get_selected)
            buttonBox.rejected.connect(self.reject)
                
            layout = QVBoxLayout()
            layout.addWidget(self.timesheetList)
            layout.addWidget(buttonBox)
            
            self.setLayout(layout)
Пример #57
0
 def on_rightButton_clicked(self):
     """
     Private slot to add an action to the list.
     """
     row = self.toolbarActionsList.currentRow() + 1
         
     item = QListWidgetItem()
     if self.actionsTree.currentItem().text(0) == self.__separatorText:
         item.setText(self.__separatorText)
         actionID = None
     else:
         actionID = self.actionsTree.currentItem()\
             .data(0, E5ToolBarDialog.ActionIdRole)
         action = self.__manager.actionById(actionID)
         item.setText(action.text())
         item.setIcon(action.icon())
         item.setTextAlignment(Qt.AlignLeft | Qt.AlignVCenter)
         item.setData(E5ToolBarDialog.ActionIdRole, int(id(action)))
         item.setData(E5ToolBarDialog.WidgetActionRole, False)
         if self.__manager.isWidgetAction(action):
             item.setData(E5ToolBarDialog.WidgetActionRole, True)
             item.setData(Qt.TextColorRole, QColor(Qt.blue))
             oldTbItemID = self.__widgetActionToToolBarItemID[actionID]
             if oldTbItemID is not None:
                 self.__toolbarItems[oldTbItemID].actionIDs.remove(actionID)
                 self.__toolbarItems[oldTbItemID].isChanged = True
                 self.__toolBarItemToWidgetActionID[oldTbItemID]\
                     .remove(actionID)
             self.__widgetActionToToolBarItemID[actionID] = \
                 id(self.__currentToolBarItem)
             self.__toolBarItemToWidgetActionID[
                 id(self.__currentToolBarItem)].append(actionID)
     self.toolbarActionsList.insertItem(row, item)
     self.__currentToolBarItem.actionIDs.insert(row, actionID)
     self.__currentToolBarItem.isChanged = True
     self.toolbarActionsList.setCurrentRow(row)
     self.__setupButtons()
Пример #58
0
    def createGroupBox(self, layout):

        group1 = QGroupBox(self)
        group1.setTitle(self.tr("KDE Themes"))
        group1.setMinimumHeight(180)
        layout.addWidget(group1)

        grLayout = QVBoxLayout(group1)
        listWidget1 = QListWidget(group1)
        grLayout.addWidget(listWidget1)

        layout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))


        group2 = QGroupBox(self)
        group2.setTitle(self.tr("Icon Sets"))
        group2.setMinimumHeight(140)
        group2.setMaximumHeight(150)
        layout.addWidget(group2)

        grLayout2 = QVBoxLayout(group2)
        listWidget2 = QListWidget(group2)
        listWidget2.setViewMode(QListView.IconMode)
        listWidget2.setIconSize(QSize(384, 72))
        item = QListWidgetItem(listWidget2)
        item.setIcon(QIcon(":/data/images/oxygen-set.png"))
        item.setText("Oxygen")

        item = QListWidgetItem(listWidget2)
        item.setIcon(QIcon(":/data/images/breeze-set.png"))
        item.setText("Breeze")
        item.setSelected(True)

        listWidget2.itemClicked.connect(self.iconSetSelect)

        grLayout2.addWidget(listWidget2)
Пример #59
0
 def run(self):
     """
     Run method that makes an infinite loop
     and receives continuous data from the server socket
     """
     while True:
         try:
             data = self.receive()
             print(data)
             data = self.receive_message(data)
             print("Got data: ", data)
             if data is True:
                 continue
             tab = self.set_data_to_correct_tab(data['type'])
             item = QListWidgetItem(tab.children()[0])
             message = str(data['message'])
             check_for_icon = Client.check_text(message)
             item.setText("%s: %s" % (self.members[data['username']].username, message))
             if check_for_icon is True:
                 path = os.path.dirname(os.path.abspath(__file__))
                 item.setIcon(QIcon(path + "/pictures/python.jpg"))
         except socket.timeout:
             continue
     self.sock.close()
Пример #60
0
    def __init__(self, settings_object, parent=None):
        super().__init__(parent)

        # The settings object should not be changed directly. Use enqueue_change() to set values and call
        # commit_changes() to write them to file when the user clicks either the "Ok" or "Apply" button.
        self.settings_object = settings_object
        self.pending_changes = {}

        # A list of different settings groups, categorized by the application they apply to.
        self.category_list = QListWidget()
        self.category_list.setSpacing(3)
        self.category_list.setMaximumWidth(100)
        handlebar_category = QListWidgetItem(self.category_list)
        handlebar_category.setText('General')
        handbrake_category = QListWidgetItem(self.category_list)
        handbrake_category.setText('Encoder')
        handbrake_category = QListWidgetItem(self.category_list)
        handbrake_category.setText('Output')

        self.category_pages = QStackedWidget()
        self.category_pages.addWidget(GeneralSettingsPage(self, settings_object))
        self.category_pages.addWidget(EncoderSettingsPage(self, settings_object))
        self.category_pages.addWidget(OutputSettingsPage(self, settings_object))

        self.category_list.setCurrentRow(0)
        self.category_list.currentItemChanged.connect(self.change_category)

        category_layout = QHBoxLayout()
        category_layout.addWidget(self.category_list)
        category_layout.addWidget(self.category_pages)

        ok_button = QPushButton('Ok')
        cancel_button = QPushButton('Cancel')
        self.apply_button = QPushButton('Apply')
        self.apply_button.setEnabled(False)

        ok_button.clicked.connect(self.commit_changes_and_close)
        cancel_button.clicked.connect(self.close)
        self.apply_button.clicked.connect(self.commit_changes)

        button_bar_layout = QHBoxLayout()
        button_bar_layout.addStretch(1)
        button_bar_layout.addWidget(ok_button)
        button_bar_layout.addWidget(cancel_button)
        button_bar_layout.addWidget(self.apply_button)

        main_layout = QVBoxLayout()
        main_layout.addLayout(category_layout)
        main_layout.addLayout(button_bar_layout)
        self.setLayout(main_layout)

        self.setWindowTitle('Configure Settings')
        self.resize(600, 300)