Exemplo n.º 1
0
    def ui_beika(self):
        self.timer.start(900000)
        query = "SELECT Id, Name FROM accessories_name WHERE For_Beika = 1"
        sql_info = my_sql.sql_select(query)
        if "mysql.connector.errors" in str(type(sql_info)):
            return False

        if len(sql_info) == 1:
            self.beika_accessories_id = sql_info[0][0]
        else:
            return False

        query = """SELECT Id, Name FROM material_name WHERE For_Beika = 1 ORDER BY Name"""
        sql_info = my_sql.sql_select(query)
        if "mysql.connector.errors" in str(type(sql_info)):
            return False

        for material in sql_info:
            item = QListWidgetItem(material[1])
            item.setData(-1, (material[0]))
            item.setTextAlignment(Qt.AlignHCenter)
            self.lw_material.addItem(item)

        self.lw_material.setSpacing(5)

        self.sw_main.setCurrentIndex(9)
Exemplo n.º 2
0
 def addToQueue(self):
     newitem = QListWidgetItem()
     newitem.setText(self.video_title)
     newitem.setTextAlignment(Qt.AlignLeft)
     self.video_list.addItem(newitem)
     self.video_queue.append(self.start_url)
     pass
Exemplo n.º 3
0
 def update(self):
     self.eventQListWidget_scroll_position = self.eventQListWidget_scrollbar.value();
     self.parent.eventQListWidget.clear()
     event_data = list(filter(lambda d1: self.filter_events(d1) and self.filter_events_by_search(d1),self.parent.sports_data))
     sorted_data=sorted(event_data, key=lambda x: (x['starting']))
     
     if self.selectedSport=="All Events":
          for x in sorted_data:
              self.cw=EventWidget(self.parent)
              self.cw.setData(x)
              eventQListWidgetItem = QListWidgetItem(self.parent.eventQListWidget)
              eventQListWidgetItem.setSizeHint(self.cw.sizeHint())
              eventQListWidgetItem.setTextAlignment(Qt.AlignHCenter)
              self.parent.eventQListWidget.addItem(eventQListWidgetItem)
              self.parent.eventQListWidget.setItemWidget(eventQListWidgetItem, self.cw)
     else:
         for x in sorted_data:
             if x["sport"]==self.selectedSport:
                 self.cw=EventWidget(self.parent)
                 self.cw.setData(x)
                 eventQListWidgetItem = QListWidgetItem(self.parent.eventQListWidget)
                 eventQListWidgetItem.setSizeHint(self.cw.sizeHint())
                 self.parent.eventQListWidget.addItem(eventQListWidgetItem)
                 self.parent.eventQListWidget.setItemWidget(eventQListWidgetItem, self.cw)
     self.eventQListWidget_scrollbar.setValue(self.eventQListWidget_scroll_position)
     self.parent.betting_main_widget.disable_All_Events() #disable events for existing parlay slip
     self.parent.betting_main_widget.update_slips_from_events() #update all slips with new event_data.
Exemplo n.º 4
0
        def __init__(self, parent=None):
            super().__init__(parent)

            menu_widget = QListWidget()
            for i in range(10):
                item = QListWidgetItem('Item {}'.format(i))
                item.setTextAlignment(Qt.AlignCenter)
                menu_widget.addItem(item)

            text = """
			This displays a two column widget,
			with a QListWidget on the left and a QLabel and a QPushButton on the right.
			It looks like this when you run the code:
			"""
            text_widget = QLabel(text)
            button = QPushButton('Something')

            content_layout = QVBoxLayout()
            content_layout.addWidget(text_widget)
            content_layout.addWidget(button)
            main_widget = QWidget()
            main_widget.setLayout(content_layout)

            layout = QHBoxLayout()
            layout.addWidget(menu_widget, 1)
            layout.addWidget(main_widget, 4)
            self.setLayout(layout)
Exemplo n.º 5
0
    def ui_beika(self):
        self.timer.start(900000)
        query = "SELECT Id, Name FROM accessories_name WHERE For_Beika = 1"
        sql_info = my_sql.sql_select(query)
        if "mysql.connector.errors" in str(type(sql_info)):
            return False

        if len(sql_info) == 1:
            self.beika_accessories_id = sql_info[0][0]
        else:
            return False

        query = """SELECT Id, Name FROM material_name WHERE For_Beika = 1 ORDER BY Name"""
        sql_info = my_sql.sql_select(query)
        if "mysql.connector.errors" in str(type(sql_info)):
            return False

        for material in sql_info:
            item = QListWidgetItem(material[1])
            item.setData(-1, (material[0]))
            item.setTextAlignment(Qt.AlignHCenter)
            self.lw_material.addItem(item)

        self.lw_material.setSpacing(5)

        self.sw_main.setCurrentIndex(9)
Exemplo n.º 6
0
    def createLeftBind(self):
        bindWidget = QListWidget()
        bindWidget.setSpacing(5)

        azoneButton = QListWidgetItem(bindWidget)
        azoneButton.setText("添加域")
        azoneButton.setTextAlignment(Qt.AlignHCenter)
        azoneButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        zoneButton = QListWidgetItem(bindWidget)
        zoneButton.setText("域管理")
        zoneButton.setTextAlignment(Qt.AlignHCenter)
        zoneButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        aviewButton = QListWidgetItem(bindWidget)
        aviewButton.setText("添加视图")
        aviewButton.setTextAlignment(Qt.AlignHCenter)
        aviewButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        viewButton = QListWidgetItem(bindWidget)
        viewButton.setText("视图管理")
        viewButton.setTextAlignment(Qt.AlignHCenter)
        viewButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        ipbeButton = QListWidgetItem(bindWidget)
        ipbeButton.setText("IP归属地")
        ipbeButton.setTextAlignment(Qt.AlignHCenter)
        ipbeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        return bindWidget
Exemplo n.º 7
0
    def upload(self, which_file):
        """
        Handles the upload of a file from a file-upload dialog. This function is ran after a user clicks 'Open'
        after selecting a template or vars file.

        Parameters
        ----------
        which_file : str
            Which file (Template or Variables) is being uploaded.
        """
        if which_file == '.xls':
            file_path = QFileDialog().getOpenFileName(filter='*.xls')[0]
            icon_name = os.path.join(sys.path[1], 'assets\\excel_icon.png')
            listbox = self.VarsDrop
        else:
            file_path = QFileDialog().getOpenFileName(filter='*.docx')[0]
            icon_name = os.path.join(sys.path[1], 'assets\\word_icon.png')
            listbox = self.TemplateDrop

        if not file_path:
            listbox.setDefaultContents()
        else:
            file_name = file_path.split('/')[-1]
            listbox.cur_file = file_path
            listbox.clear()
            item = QListWidgetItem(QIcon(icon_name), file_name)
            item.setFont(QFont(None, 12))
            item.setSizeHint(QSize(256, 256))
            item.setTextAlignment(Qt.AlignCenter)
            listbox.addItem(item)
Exemplo n.º 8
0
    def dialog_system_answer_message_received(self, message):
        log.debug(f"Текст от системы: {message}")

        # Отправить ответ системы в чат
        new_message_item = QListWidgetItem(message)
        new_message_item.setTextAlignment(Qt.AlignLeft)
        self.ui.dialog_widget.addItem(new_message_item)
Exemplo n.º 9
0
 def update_HistoryList(self, page, flag):
     self.historyList.clear()
     try:
         if flag == 1:
             self.page += 1
         elif flag == 2 and (self.page - 1) > -1:
             self.page -= 1
         else:
             self.page = 0
         self.pageLabel.setText(str(self.page))
         headers = {
             "X-Auth-Token": self.token,
         }
         # print(self.IdEdit.text(),type(self.IdEdit.text()))
         data = {
             "player_id": int(self.IdEdit.text()),
             "limit": 20,
             "page": self.page
         }
         response = requests.get("http://api.revth.com/history",
                                 data=data,
                                 headers=headers)
         self.listData = json.loads(response.text)["data"]
         for item in self.listData:
             i = QListWidgetItem()
             i.setText("战局ID:" + str(item["id"]) + "  得分:" +
                       str(item["score"]) + "  结算时间:" +
                       str(item["timestamp"]))
             i.setTextAlignment(Qt.AlignCenter)
             i.setSizeHint(QSize(200, 50))
             self.historyList.addItem(i)
     except Exception as e:
         print(e)
Exemplo n.º 10
0
 def initCategories(self):
     generalButton = QListWidgetItem(self.categories)
     generalButton.setIcon(QIcon(':/images/settings-general.png'))
     generalButton.setText('General')
     generalButton.setToolTip('General settings')
     generalButton.setTextAlignment(Qt.AlignHCenter)
     generalButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     videoButton = QListWidgetItem(self.categories)
     videoButton.setIcon(QIcon(':/images/settings-video.png'))
     videoButton.setText('Video')
     videoButton.setToolTip('Video settings')
     videoButton.setTextAlignment(Qt.AlignHCenter)
     videoButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     themeButton = QListWidgetItem(self.categories)
     themeButton.setIcon(QIcon(':/images/settings-theme.png'))
     themeButton.setText('Theme')
     themeButton.setToolTip('Theme settings')
     themeButton.setTextAlignment(Qt.AlignHCenter)
     themeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     ffmpegButton = QListWidgetItem(self.categories)
     ffmpegButton.setIcon(QIcon(':/images/settings-ffmpeg.png'))
     ffmpegButton.setText('Tools')
     ffmpegButton.setToolTip('Tools settings')
     ffmpegButton.setTextAlignment(Qt.AlignHCenter)
     ffmpegButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     logsButton = QListWidgetItem(self.categories)
     logsButton.setIcon(QIcon(':/images/settings-logs.png'))
     logsButton.setText('Logs')
     logsButton.setToolTip('Logging settings')
     logsButton.setTextAlignment(Qt.AlignHCenter)
     logsButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     self.categories.currentItemChanged.connect(self.changePage)
     self.categories.setCurrentRow(0)
     self.categories.setMaximumWidth(
         self.categories.sizeHintForColumn(0) + 2)
Exemplo n.º 11
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()
Exemplo n.º 12
0
 def accept(self):
     while self.running:
         try:
             mes = self.socket.recv(4096)
             mes = pickle.loads(mes)
             print(mes)
             if type(mes) == list:
                 if type(mes[0]) == str:
                     if mes[0] == 'to stop':
                         self.stopbtn.click()
                     else:
                         self.active.clear()
                         for i in mes:
                             if i == self.name:
                                 i = 'You'
                             a = QListWidgetItem(str(i))
                             a.setTextAlignment(0x0004)
                             self.active.addItem(a)
                 else:
                     print(mes)
                     self.clientresult = mes
                     self.disp.click()
             elif type(mes) == dict:
                 self.typing = list(mes.values())[0]
                 self.startmode.click()
             elif mes == 'Admin: start':
                 self.startmode.click()
             else:
                 self.list.addItem(QListWidgetItem('{}'.format(mes)))
         except:
             pass
Exemplo n.º 13
0
    def show_details(self, clickedIndex):

        self.projectView.hide()
        self.status_push.hide()
        self.search_push.hide()
        self.search_line_edit.hide()
        self.search_lable.hide()
        self.comboBox.hide()
        self.main_minue.hide()
        df = self.projectModel._data
        header = list(df)
        self.record = df.values.tolist()[clickedIndex.row()]

        self.listWidget.clear()
        self.listWidget.show()
        self.back_push.show()
        self.show_report.show()

        txt = ""
        for h, d in zip(header, self.record):
            txt += str(h) + ": " + str(d) + "\n\n"

        it = QListWidgetItem(txt)

        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(200)
        font.setPointSize(12)
        it.setFont(font)
        it.setBackground(QtGui.QBrush(QtGui.QColor("lightblue")))
        it.setTextAlignment(Qt.AlignRight)

        self.listWidget.addItem(it)
Exemplo n.º 14
0
    def initUi(self):
        # 初始化界面
        # 通过QListWidget的当前item变化来切换QStackedWidget中的序号
        self.listWidget.currentRowChanged.connect(
            self.stackedWidget.setCurrentIndex)
        # 去掉边框
        self.listWidget.setFrameShape(QListWidget.NoFrame)
        # 隐藏滚动条
        self.listWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.listWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # 这里就用一般的文本配合图标模式了(也可以直接用Icon模式,setViewMode)
        for i in range(20):
            item = QListWidgetItem(QIcon('images/0%d.ico' % randint(1, 8)),
                                   str('选 项 %s' % i), self.listWidget)
            # 设置item的默认宽高(这里只有高度比较有用)
            item.setSizeHint(QSize(16777215, 60))
            # 文字居中
            item.setTextAlignment(Qt.AlignCenter)

        # 再模拟20个右侧的页面(就不和上面一起循环放了)
        for i in range(20):
            label = QLabel('我是页面 %d' % i, self)
            label.setAlignment(Qt.AlignCenter)
            # 设置label的背景颜色(这里随机)
            # 这里加了一个margin边距(方便区分QStackedWidget和QLabel的颜色)
            label.setStyleSheet(
                'background: rgb(%d, %d, %d);margin: 50px;' %
                (randint(0, 255), randint(0, 255), randint(0, 255)))
            self.stackedWidget.addWidget(label)
Exemplo n.º 15
0
 def click(self):
     if self.le.text() != '':
         if self.cb.currentText() == 'Название':
             con = sqlite3.connect('books.sqlite')
             cur = con.cursor()
             nam = self.le.text()
             zap = f"SELECT name FROM books WHERE name LIKE '%{nam}%' "
             res = cur.execute(zap).fetchall()
             self.lw.clear()
             for i in res:
                 item = QListWidgetItem(i[0])
                 item.setTextAlignment(Qt.AlignHCenter)
                 self.lw.addItem(item)
             con.commit()
             con.close()
         elif self.cb.currentText() == 'Автор':
             con = sqlite3.connect('books.sqlite')
             cur = con.cursor()
             nam = self.le.text()
             zap = f"SELECT name FROM books WHERE author_id = (SELECT id from authors WHERE author LIKE '%{nam}%') "
             res = cur.execute(zap).fetchall()
             self.lw.clear()
             for i in res:
                 item = QListWidgetItem(i[0])
                 item.setTextAlignment(Qt.AlignHCenter)
                 self.lw.addItem(item)
             con.commit()
             con.close()
Exemplo n.º 16
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        self.lblExporterName.setStyleSheet(S.titleLabelSS())

        # Var
        self.currentExporter = None

        # Populates lite
        self.lstExporters.clear()
        for E in exporter.exporters:
            item = QListWidgetItem(QIcon(E.icon), E.name)
            self.lstExporters.addItem(item)

        # UI
        for i in range(self.lstExporters.count()):
            item = self.lstExporters.item(i)
            item.setSizeHint(QSize(item.sizeHint().width(), 42))
            item.setTextAlignment(Qt.AlignCenter)
        self.lstExporters.setMaximumWidth(150)
        self.lstExporters.setMinimumWidth(150)

        self.lstExporters.currentTextChanged.connect(self.updateUi)
        self.lstExportTo.currentTextChanged.connect(self.updateFormatDescription)

        self.lstExporters.setCurrentRow(0)

        self.btnSetPath.clicked.connect(self.setAppPath)
        self.txtPath.editingFinished.connect(self.updateAppPath)
 def aggiungi_item(self, lista, nome):
     item = QListWidgetItem(nome)
     item.setTextAlignment(Qt.AlignCenter)
     font = QFont("Arial", 16)
     font.setWeight(50)
     item.setFont(font)
     lista.addItem(item)
Exemplo n.º 18
0
 def update_list(self):
     self.lessonList.clear()
     for lesson in self.parent.lessons["All Lessons"]:
         lesson_name = list(lesson.values())[0]["name"]
         lesson_item = QListWidgetItem(lesson_name)
         lesson_item.setTextAlignment(int(Qt.AlignVCenter) | int(Qt.AlignHCenter))
         self.lessonList.addItem(lesson_item)
Exemplo n.º 19
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()
Exemplo n.º 20
0
    def __init__(self, owner):
        super(self.__class__, self).__init__(owner)
        Ui_User.__init__(self)
        self.setupUi(self)
        self.owner = weakref.ref(owner)
        self.setWindowTitle("哔咔漫画")

        pix = QtGui.QPixmap()
        pix.loadFromData(resources.DataMgr.GetData("placeholder_avatar"))
        pix.scaled(self.icon.size(), Qt.KeepAspectRatio)
        self.icon.setScaledContents(True)
        self.icon.setPixmap(pix)

        self.listWidget.currentRowChanged.connect(self.Switch)
        self.listWidget.setFrameShape(QListWidget.NoFrame)
        self.listWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.listWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        for name in ["搜索", "分类", "排行", "收藏", "历史记录", "下载"]:
            item = QListWidgetItem(name, self.listWidget)
            item.setSizeHint(QSize(16777215, 60))
            item.setTextAlignment(Qt.AlignCenter)

        self.stackedWidget.addWidget(self.owner().searchForm)
        self.stackedWidget.addWidget(self.owner().categoryForm)
        self.stackedWidget.addWidget(self.owner().rankForm)
        self.stackedWidget.addWidget(self.owner().favoriteForm)
        self.stackedWidget.addWidget(self.owner().historyForm)
        self.stackedWidget.addWidget(self.owner().downloadForm)
Exemplo n.º 21
0
    def __init__(self, parent=None):
        QWidget.__init__(self, parent)
        self.setupUi(self)
        self.lblExporterName.setStyleSheet(S.titleLabelSS())

        # Var
        self.currentExporter = None

        # Populates lite
        self.lstExporters.clear()
        for E in exporter.exporters:
            item = QListWidgetItem(QIcon(E.icon), E.name)
            self.lstExporters.addItem(item)

        # UI
        for i in range(self.lstExporters.count()):
            item = self.lstExporters.item(i)
            item.setSizeHint(QSize(item.sizeHint().width(), 42))
            item.setTextAlignment(Qt.AlignCenter)
        self.lstExporters.setMaximumWidth(150)
        self.lstExporters.setMinimumWidth(150)

        self.lstExporters.currentTextChanged.connect(self.updateUi)
        self.lstExportTo.currentTextChanged.connect(
            self.updateFormatDescription)

        self.lstExporters.setCurrentRow(0)

        self.btnSetPath.clicked.connect(self.setAppPath)
        self.txtPath.editingFinished.connect(self.updateAppPath)
Exemplo n.º 22
0
 def renderClips(self, cliptimes: list) -> int:
     self.clear()
     externalCount = 0
     for index, clip in enumerate(cliptimes):
         chapterName, endItem = '', ''
         if isinstance(clip[1], QTime):
             endItem = clip[1].toString(self.parent.timeformat)
             self.parent.totalRuntime += clip[0].msecsTo(clip[1])
         listitem = QListWidgetItem(self)
         listitem.setToolTip('Drag to reorder clips')
         if len(clip[3]):
             listitem.setToolTip(clip[3])
             externalCount += 1
         if self.parent.createChapters:
             chapterName = clip[4] if clip[
                 4] is not None else 'Chapter {}'.format(index + 1)
         listitem.setStatusTip(
             'Reorder clips with mouse drag & drop or right-click menu on the clip to be moved'
         )
         listitem.setTextAlignment(Qt.AlignVCenter)
         listitem.setData(Qt.DecorationRole + 1, clip[2])
         listitem.setData(Qt.DisplayRole + 1,
                          clip[0].toString(self.parent.timeformat))
         listitem.setData(Qt.UserRole + 1, endItem)
         listitem.setData(Qt.UserRole + 2, clip[3])
         listitem.setData(Qt.UserRole + 3, chapterName)
         listitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled
                           | Qt.ItemIsEnabled)
         self.addItem(listitem)
         if isinstance(clip[1], QTime) and not len(clip[3]):
             self.parent.seekSlider.addRegion(
                 clip[0].msecsSinceStartOfDay(),
                 clip[1].msecsSinceStartOfDay())
     return externalCount
Exemplo n.º 23
0
    def initUi(self):
        # Initialization interface
        # Switch the sequence number in QStackedWidget by the current item change of QListWidget
        self.listWidget.currentRowChanged.connect(
            self.stackedWidget.setCurrentIndex)
        # Remove the border
        self.listWidget.setFrameShape(QListWidget.NoFrame)
        # Hide scroll bar
        self.listWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.listWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)

        # Here we use the general text with the icon mode (you can also use Icon mode, setViewMode directly)
        for i in range(5):
            item = QListWidgetItem(QIcon('Ok.png'), str('Option %s' % i),
                                   self.listWidget)
            # Set the default width and height of the item (only height is useful here)
            item.setSizeHint(QSize(16777215, 60))
            # Text centered
            item.setTextAlignment(Qt.AlignCenter)

        # Simulate 5 right-side pages (it won't loop with the top)
        for i in range(5):
            label = QLabel('This is the page %d' % i, self)
            label.setAlignment(Qt.AlignCenter)
            # Set the background color of the label (randomly here)
            # Added a margin margin here (to easily distinguish between QStackedWidget and QLabel colors)
            label.setStyleSheet(
                'background: rgb(%d, %d, %d); margin: 50px;' %
                (randint(0, 255), randint(0, 255), randint(0, 255)))
            self.stackedWidget.addWidget(label)
Exemplo n.º 24
0
 def sendmessage(self):
     mymes = QListWidgetItem('You: {}'.format(self.line.text()))
     mymes.setTextAlignment(2)
     for i in self.conns.values():
         i.send(pickle.dumps('Admin: ' + self.line.text()))
     self.list.addItem(mymes)
     self.line.setText('')
Exemplo n.º 25
0
    def initUi(self):
        # 初始化界面
        font = QFont("雅黑")
        pointsize = font.pointSize()
        font.setPixelSize(pointsize * 95 / 72)
        app.setFont(font)
        # 通过QListWidget的当前item变化来切换QStackedWidget中的序号
        self.listWidget.currentRowChanged.connect(
            self.stackedWidget.setCurrentIndex)
        # 去掉边框
        self.listWidget.setFrameShape(QListWidget.NoFrame)
        # 隐藏滚动条
        self.listWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.listWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # 这里就用一般的文本配合图标模式了(也可以直接用Icon模式,setViewMode)
        menu = ["首页", "模块设置", "在线识别", "离线检索", "信息查看", "退出系统"]
        for i, title in enumerate(menu):
            item = QListWidgetItem(QIcon('Data/%d.ico' % i), title,
                                   self.listWidget)
            # 设置item的默认宽高(这里只有高度比较有用)
            item.setSizeHint(QSize(16777215, 50))
            # 文字居中
            item.setTextAlignment(Qt.AlignCenter)

        # 再模拟20个右侧的页面(就不和上面一起循环放了)
        for i in range(20):
            w = QWidget()
            label2 = QLabel('我是buy页面 %d' % i, w)
            label2.setAlignment(Qt.AlignCenter)
            # 设置label的背景颜色(这里随机)
            # 这里加了一个margin边距(方便区分QStackedWidget和QLabel的颜色)
            label2.setStyleSheet(
                'background: rgb(%d, %d, %d);margin: 50px;' %
                (randint(0, 120), randint(0, 255), randint(0, 255)))
            self.stackedWidget.addWidget(w)
Exemplo n.º 26
0
    def item_clicked_event(self, user_msgs_history):
        # история сообщений с выбранными пользователем
        # TODO заменить sleep на проверку обработки ответа от сервера
        self.list_msgs.clear()  # очищаем окно чата

        if not user_msgs_history:
            self.list_msgs.addItem('Сообщений нет')

        for msg in user_msgs_history:
            text_color = '#beaed4'
            text_align = QtCore.Qt.AlignLeft
            text_direction = 'от'
            if msg[1] == 'out':
                text_color = 'yellow'
                text_align = QtCore.Qt.AlignRight
                text_direction = 'для'

            msg_info = QListWidgetItem(f'{msg[3]} Сообщение {text_direction} {msg[0]}:')
            msg_text = QListWidgetItem(f'{msg[2]}')
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            msg_info.setFont(font)
            msg_text.setFont(font)
            msg_info.setTextAlignment(text_align)
            msg_text.setTextAlignment(text_align)
            msg_info.setBackground(QtGui.QColor(text_color))
            msg_text.setBackground(QtGui.QColor(text_color))
            self.list_msgs.addItem(msg_info)
            self.list_msgs.addItem(msg_text)

            time.sleep(0.01)
            self.list_msgs.scrollToBottom()
Exemplo n.º 27
0
 def renderTimes(self) -> None:
     self.cliplist.clear()
     self.seekSlider.setCutMode(self.inCut)
     if len(self.clipTimes) > 4:
         self.cliplist.setFixedWidth(200)
     else:
         self.cliplist.setFixedWidth(185)
     self.totalRuntime = 0
     for item in self.clipTimes:
         endItem = ''
         if type(item[1]) is QTime:
             endItem = item[1].toString(self.timeformat)
             self.totalRuntime += item[0].msecsTo(item[1])
         listitem = QListWidgetItem()
         listitem.setTextAlignment(Qt.AlignVCenter)
         if type(item[2]) is QPixmap:
             listitem.setIcon(QIcon(item[2]))
         self.cliplist.addItem(listitem)
         marker = QLabel(
             '''<style>b { font-size:8pt; } p { margin:5px; }</style>
                         <p><b>START</b><br/>%s</p><p><b>END</b><br/>%s</p>'''
             % (item[0].toString(self.timeformat), endItem))
         self.cliplist.setItemWidget(listitem, marker)
         listitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsDragEnabled
                           | Qt.ItemIsEnabled)
     if len(self.clipTimes) and not self.inCut:
         self.saveAction.setEnabled(True)
     if self.inCut or len(self.clipTimes) == 0 or not type(
             self.clipTimes[0][1]) is QTime:
         self.saveAction.setEnabled(False)
     self.setRunningTime(
         self.deltaToQTime(self.totalRuntime).toString(self.timeformat))
Exemplo n.º 28
0
    def dropEvent(self, event):
        if event.mimeData().hasUrls():
            event.setDropAction(Qt.CopyAction)

            url = event.mimeData().urls()[-1]
            if not url.isLocalFile() or not url.toLocalFile().endswith(
                    self.which_file):
                event.ignore()
            else:
                if self.which_file == '.docx':
                    icon = QIcon(
                        os.path.join(sys.path[1], 'assets\\word_icon.png'))
                else:
                    icon = QIcon(
                        os.path.join(sys.path[1], 'assets\\excel_icon.png'))

                file_name = str(url.toLocalFile()).split('/')[-1]
                self.cur_file = str(url.toLocalFile())
                self.clear()

                item = QListWidgetItem(icon, file_name)
                item.setFont(QFont(None, 12))
                item.setSizeHint(QSize(256, 256))
                item.setTextAlignment(Qt.AlignCenter)
                self.addItem(item)
        else:
            event.ignore()
Exemplo n.º 29
0
    def initUi(self):
        # 初始化界面
        # 通过QListWidget的当前item变化来切换QStackedWidget中的序号
        self.listWidget.currentRowChanged.connect(
            self.stackedWidget.setCurrentIndex)
        # 去掉边框
        self.listWidget.setFrameShape(QListWidget.NoFrame)
        # 隐藏滚动条
        title_list=["说明","轮廓","眼部","眉毛","嘴巴","鼻子"]
        self.listWidget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.listWidget.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        # 这里就用一般的文本配合图标模式了(也可以直接用Icon模式,setViewMode)
        for i in title_list:
            item = QListWidgetItem(i, self.listWidget)
            # 设置item的默认宽高(这里只有高度比较有用)
            item.setSizeHint(QSize(16777215, 60))
            # 文字居中
            item.setTextAlignment(Qt.AlignCenter)

        # 再模拟20个右侧的页面(就不和上面一起循环放了)
        for i in title_list:
            label=QLabel()
            label.setText(i+"内容")
            self.stackedWidget.addWidget(label)
        self.setStyleSheet(Stylesheet)
Exemplo n.º 30
0
class MainWidget(QWidget):
    def __init__(self):
        super().__init__()
        self.list = None
        self.stack = None
        self.train_item = None
        self.test_item = None
        self.training_widget = None
        self.testing_widget = None
        self.init_ui()

    def init_ui(self):
        box = QHBoxLayout()

        self.list = CustomList()
        self.list.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.list.setSelectionMode(CustomList.SingleSelection)
        self.train_item = QListWidgetItem("Training")
        self.train_item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.test_item = QListWidgetItem("Testing")
        self.test_item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.list.addItem(self.train_item)
        self.list.addItem(self.test_item)
        self.list.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.list.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        shadow = QGraphicsDropShadowEffect()
        shadow.setColor(QColor(179, 179, 179, 40).darker(800))
        shadow.setXOffset(1)
        shadow.setYOffset(0)
        self.list.setGraphicsEffect(shadow)
        self.list.setCurrentRow(0)

        self.stack = QStackedLayout()
        self.training_widget = TrainingWidget()
        self.training_widget.training.connect(self.handle_training)
        self.testing_widget = TestingWidget()
        self.stack.addWidget(self.training_widget)
        self.stack.addWidget(self.testing_widget)

        self.list.currentRowChanged.connect(self.stack.setCurrentIndex)
        box.setSpacing(70)
        box.addWidget(self.list)
        box.addLayout(self.stack)
        self.setLayout(box)

        self.setObjectName("main")
        self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        self.setWindowFlags(QtCore.Qt.Widget | QtCore.Qt.MSWindowsFixedSizeDialogHint)
        self.layout().setContentsMargins(0, 0, 0, 0)
        self.setWindowTitle('Demo')
        self.show()

    @pyqtSlot(bool)
    def handle_training(self, is_running):
        if is_running:
            self.test_item.setFlags(self.test_item.flags() & ~QtCore.Qt.ItemIsEnabled)
        else:
            self.test_item.setFlags(self.test_item.flags() | QtCore.Qt.ItemIsEnabled)
Exemplo n.º 31
0
    def AddItem(self, name):
        item = QListWidgetItem(name)
        item.setTextAlignment(Qt.AlignCenter)
        # item.setBackground(QColor(87, 195, 194))
        item.setBackground(QColor(0, 0, 0, 0))
        item.setSizeHint(QSize(90, 30))
        item.setFlags(item.flags() & (~Qt.ItemIsSelectable))

        self.addItem(item)
Exemplo n.º 32
0
 def update_album_list(self):
     self.album_viewer.clear()
     for i in self.dict_albums:
         item = QListWidgetItem()
         item.setText(i)
         item.setIcon(QIcon('image/photo.png'))
         item.setSizeHint(QSize(128, 128))
         self.album_viewer.addItem(item)
         item.setTextAlignment(Qt.AlignCenter)
Exemplo n.º 33
0
 def reset_list_view(self):
     self.listview.clear()
     for i in self.list_of_folder:
         item = QListWidgetItem()
         item.setSizeHint(QSize(128, 128))
         item.setIcon(QIcon(i))
         item.setText(self.get_name_from_path(i))
         self.listview.addItem(item)
         item.setTextAlignment(Qt.AlignCenter)
Exemplo n.º 34
0
    def createTabDesktopTheme(self):
        self.tabDesktopTheme = QWidget()
        self.tabDesktopTheme.setObjectName("tabDesktopTheme")
        
        self.verticalLayout_4 = QVBoxLayout(self.tabDesktopTheme)
        self.verticalLayout_4.setObjectName("verticalLayout_4")

        self.listWidgetDesktopTheme = QListWidget(self.tabDesktopTheme)
        self.listWidgetDesktopTheme.setObjectName("listWidgetDesktopTheme")
        self.listWidgetDesktopTheme.setViewMode(QListView.IconMode)
        self.listWidgetDesktopTheme.setIconSize(QSize(240, 145))
        self.listWidgetDesktopTheme.setResizeMode(QListView.Adjust)

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        icon = QIcon(QPixmap(":/data/images/air_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "air"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/breeze_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "default"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/breeze-dark_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "breeze-dark"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/midna_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "midna"
        
        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/midna-dark_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "midna_dark"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/oxygen_panel.png").scaled(QSize(240, 145), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(240, 145))
        item.setIcon(icon)
        item.panelText = "oxygen"
        
        self.verticalLayout_4.addWidget(self.listWidgetDesktopTheme)

        self.addTab(self.tabDesktopTheme, self.tr("Desktop Theme"))
Exemplo n.º 35
0
    def set_sql_salary_date(self):
        query = """(SELECT Date_Pay FROM pack_operation WHERE Pay = 1 AND Worker_Id = %s GROUP BY Date_Pay ORDER BY Date_Pay DESC)
                    UNION
                    (SELECT Date_Pay FROM pay_worker WHERE Pay = 1 AND Worker_Id = %s GROUP BY Date_Pay ORDER BY Date_Pay DESC)
                    ORDER BY Date_Pay DESC LIMIT 3"""
        sql_info = my_sql.sql_select(query, (self.work, self.work))
        if "mysql.connector.errors" in str(type(sql_info)):
            return False

        for date in sql_info:
            date_item = QListWidgetItem(date[0].strftime("%d.%m.%Y"))
            date_item.setData(-1, date[0])
            date_item.setTextAlignment(Qt.AlignHCenter)
            self.lw_date_salary.addItem(date_item)
Exemplo n.º 36
0
    def __init__(self, parent = None):
        super(LeftUi, self).__init__(parent)
        self.setupUi(self)
        # 对应字体库里面的搜索图标
        self.blog_search_button.setText("\uf002")
        # 设置间隔
        self.blog_menu_list.setSpacing(10)
        # 设置动画效果
        ButtonRotationRnimation(self.blog_head_label)

        # 绑定登录成功后设置头像的信号
        Signal().Login_Success.connect(self.setHead)

        # 测试数据
        for menu in ("PyQt", "Python", "Android", "About", "Message"):
            item = QListWidgetItem(menu, self.blog_menu_list)
            item.setTextAlignment(Qt.AlignHCenter)
Exemplo n.º 37
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()
Exemplo n.º 38
0
    def createIcons(self):
        basicButton = QListWidgetItem(self.contentsWidget)
        basicButton.setIcon(QIcon('app/ui/images/settings.png'))
        basicButton.setText("Základní filtry")
        basicButton.setTextAlignment(Qt.AlignHCenter)
        basicButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        timeButton = QListWidgetItem(self.contentsWidget)
        timeButton.setIcon(QIcon('app/ui/images/time.png'))
        timeButton.setText("Datum a čas")
        timeButton.setTextAlignment(Qt.AlignHCenter)
        timeButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        locationButton = QListWidgetItem(self.contentsWidget)
        locationButton.setIcon(QIcon('app/ui/images/location.png'))
        locationButton.setText("Lokace")
        locationButton.setTextAlignment(Qt.AlignHCenter)
        locationButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
Exemplo n.º 39
0
    def createIcons(self):
        configButton = QListWidgetItem(self.contentsWidget)
        configButton.setIcon(QIcon(':/images/config.png'))
        configButton.setText("Configuration")
        configButton.setTextAlignment(Qt.AlignHCenter)
        configButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        updateButton = QListWidgetItem(self.contentsWidget)
        updateButton.setIcon(QIcon(':/images/update.png'))
        updateButton.setText("Update")
        updateButton.setTextAlignment(Qt.AlignHCenter)
        updateButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        queryButton = QListWidgetItem(self.contentsWidget)
        queryButton.setIcon(QIcon(':/images/query.png'))
        queryButton.setText("Query")
        queryButton.setTextAlignment(Qt.AlignHCenter)
        queryButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)

        self.contentsWidget.currentItemChanged.connect(self.changePage)
Exemplo n.º 40
0
    def createTabDesktopTheme(self):
        self.tabDesktopTheme = QWidget()
        self.tabDesktopTheme.setObjectName("tabDesktopTheme")

        self.gridLayout = QGridLayout(self.tabDesktopTheme)
        self.gridLayout.setObjectName("gridLayout")

        self.listWidgetDesktopTheme = QListWidget(self.tabDesktopTheme)
        self.listWidgetDesktopTheme.setObjectName("listWidgetDesktopTheme")
        self.listWidgetDesktopTheme.setViewMode(QListView.IconMode)
        self.listWidgetDesktopTheme.setIconSize(QSize(660, 70))
        self.gridLayout.addWidget(self.listWidgetDesktopTheme, 0, 0, 1, 1)

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        icon = QIcon(QPixmap(":/data/images/air-panel.png").scaled(QSize(660, 70), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(660, 70))
        item.setIcon(icon)
        item.panelText = "air"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/breeze-panel.png").scaled(QSize(660, 70), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(660, 70))
        item.setIcon(icon)
        item.panelText = "default"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/breeze-dark-panel.png").scaled(QSize(660, 70), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(660, 70))
        item.setIcon(icon)
        item.panelText = "breeze-dark"

        item = QListWidgetItem(self.listWidgetDesktopTheme)
        item.setTextAlignment(Qt.AlignHCenter)
        icon = QIcon(QPixmap(":/data/images/oxygen-panel.png").scaled(QSize(660, 70), Qt.IgnoreAspectRatio, Qt.FastTransformation))
        item.setSizeHint(QSize(660, 70))
        item.setIcon(icon)
        item.panelText = "oxygen"

        self.addTab(self.tabDesktopTheme, self.tr("Desktop Theme"))
Exemplo n.º 41
0
 def __init__(self, parent: QWidget):
     super(SettingsWidget, self).__init__(parent, Qt.Window)
     # config parser
     self._cfg = configparser.ConfigParser()
     # layouts
     self._layout_main = QVBoxLayout()
     self._layout_stacks = QHBoxLayout()
     self._layout_okcancel = QHBoxLayout()
     # sections list
     self._sections_list = QListWidget(self)
     self._sections_list.setSelectionMode(QAbstractItemView.SingleSelection)
     self._sections_list.setSelectionBehavior(QAbstractItemView.SelectItems)
     self._sections_list.setIconSize(QSize(32, 32))
     self._sections_list.setViewMode(QListView.IconMode)
     self._sections_list.setMaximumWidth(80)
     self._sections_list.setGridSize(QSize(64, 64))
     self._sections_list.setFlow(QListView.TopToBottom)
     self._sections_list.setMovement(QListView.Static)  # items cannot be moved by user
     # network item
     lwi = QListWidgetItem()
     lwi.setText(self.tr("Network"))
     lwi.setTextAlignment(Qt.AlignCenter)
     lwi.setIcon(QIcon(":/i/settings_network_32.png"))
     lwi.setData(Qt.UserRole, QVariant(0))
     self._sections_list.addItem(lwi)
     lwi.setSelected(True)
     # misc item
     lwi = QListWidgetItem()
     lwi.setText(self.tr("Other"))
     lwi.setTextAlignment(Qt.AlignCenter)
     lwi.setIcon(QIcon(":/i/settings_32.png"))
     lwi.setData(Qt.UserRole, QVariant(1))
     self._sections_list.addItem(lwi)
     # connections
     self._sections_list.currentItemChanged.connect(self.on_section_current_item_changed)
     self._layout_stacks.addWidget(self._sections_list)
     # stacked widget
     self._stack = QStackedWidget(self)
     self._w_net = Settings_Net(self._stack)
     self._w_misc = Settings_Misc(self._stack)
     self._stack.addWidget(self._w_net)
     self._stack.addWidget(self._w_misc)
     self._stack.setCurrentIndex(0)
     self._layout_stacks.addWidget(self._stack)
     # ok cancel buttons
     self._btn_ok = QPushButton(self)
     self._btn_ok.setText(self.tr("Save"))
     self._btn_ok.setIcon(QIcon(":/i/save.png"))
     self._btn_cancel = QPushButton(self)
     self._btn_cancel.setText(self.tr("Cancel"))
     self._btn_cancel.setIcon(QIcon(":/i/cancel.png"))
     self._layout_okcancel.addStretch()
     self._layout_okcancel.addWidget(self._btn_ok)
     self._layout_okcancel.addWidget(self._btn_cancel)
     self._btn_ok.clicked.connect(self.on_ok)
     self._btn_cancel.clicked.connect(self.on_cancel)
     # final
     self._layout_main.addLayout(self._layout_stacks)
     self._layout_main.addLayout(self._layout_okcancel)
     self.setLayout(self._layout_main)
     self.setWindowTitle(self.tr("Settings"))
     self.setWindowIcon(QIcon(":/i/settings_32.png"))
     #
     self.load_settings()
Exemplo n.º 42
0
 def sendmessage(self):
     mymes = QListWidgetItem('You: {}'.format(self.line.text()))
     mymes.setTextAlignment(2)
     self.socket.send(pickle.dumps(self.line.text()))
     self.list.addItem(mymes)
     self.line.setText('')
Exemplo n.º 43
0
 def createIcons(self):
     SOButton = QListWidgetItem(self.nav_listWidget)
     SOButton.setIcon(QIcon('./images/sales.png'))
     SOButton.setText(u"销售管理")
     SOButton.setTextAlignment(Qt.AlignHCenter)
     SOButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     
     SOButton = QListWidgetItem(self.nav_listWidget)
     SOButton.setIcon(QIcon('./images/produce.png'))
     SOButton.setText(u"生产管理")
     SOButton.setTextAlignment(Qt.AlignHCenter)
     SOButton.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
     
     POButton=QListWidgetItem(self.nav_listWidget)
     POButton.setIcon(QIcon('./images/purchase.png'))
     POButton.setText(u"采购管理")  
     POButton.setTextAlignment(Qt.AlignHCenter)
     POButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     EngineerButton=QListWidgetItem(self.nav_listWidget)
     EngineerButton.setIcon(QIcon('./images/engineer.png'))
     EngineerButton.setText(u"工程管理")  
     EngineerButton.setTextAlignment(Qt.AlignHCenter)
     EngineerButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     
     WarehouseButton=QListWidgetItem(self.nav_listWidget)
     WarehouseButton.setIcon(QIcon('./images/warehouse.png'))
     WarehouseButton.setText(u"库存管理")  
     WarehouseButton.setTextAlignment(Qt.AlignHCenter)
     WarehouseButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     FianceButton=QListWidgetItem(self.nav_listWidget)
     FianceButton.setIcon(QIcon('./images/fiance.png'))
     FianceButton.setText(u"财务管理")  
     FianceButton.setTextAlignment(Qt.AlignHCenter)
     FianceButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     HumanButton=QListWidgetItem(self.nav_listWidget)
     HumanButton.setIcon(QIcon('./images/human.png'))
     HumanButton.setText(u"人员管理")  
     HumanButton.setTextAlignment(Qt.AlignHCenter)
     HumanButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     CostButton=QListWidgetItem(self.nav_listWidget)
     CostButton.setIcon(QIcon('./images/cost.png'))
     CostButton.setText(u"成本管理")  
     CostButton.setTextAlignment(Qt.AlignHCenter)
     CostButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     
     BasicMessageButton=QListWidgetItem(self.nav_listWidget)
     BasicMessageButton.setIcon(QIcon('./images/basicsetting.png'))
     BasicMessageButton.setText(u"基本信息")  
     BasicMessageButton.setTextAlignment(Qt.AlignHCenter)
     BasicMessageButton.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
     self.nav_listWidget.currentItemChanged.connect(self.changePage)
Exemplo n.º 44
0
    def setupMoreUi(self):

        # Tool bar on the right
        self.toolbar = collapsibleDockWidgets(Qt.RightDockWidgetArea, self)
        self.toolbar.addCustomWidget(self.tr("Book summary"), self.grpPlotSummary, self.TabPlots)
        self.toolbar.addCustomWidget(self.tr("Project tree"), self.treeRedacWidget, self.TabRedac)
        self.toolbar.addCustomWidget(self.tr("Metadata"), self.redacMetadata, self.TabRedac)
        self.toolbar.addCustomWidget(self.tr("Story line"), self.storylineView, self.TabRedac)
        if self._toolbarState:
            self.toolbar.restoreState(self._toolbarState)

        # Custom "tab" bar on the left
        self.lstTabs.setIconSize(QSize(48, 48))
        for i in range(self.tabMain.count()):
            icons = ["general-128px.png",
                     "summary-128px.png",
                     "characters-128px.png",
                     "plot-128px.png",
                     "world-128px.png",
                     "outline-128px.png",
                     "redaction-128px.png",
                     ""
                     ]
            self.tabMain.setTabIcon(i, QIcon(appPath("icons/Custom/Tabs/{}".format(icons[i]))))
            item = QListWidgetItem(self.tabMain.tabIcon(i),
                                   self.tabMain.tabText(i))
            item.setSizeHint(QSize(item.sizeHint().width(), 64))
            item.setTextAlignment(Qt.AlignCenter)
            self.lstTabs.addItem(item)
        self.tabMain.tabBar().hide()
        self.lstTabs.currentRowChanged.connect(self.tabMain.setCurrentIndex)
        self.tabMain.currentChanged.connect(self.lstTabs.setCurrentRow)

        # Splitters
        self.splitterPersos.setStretchFactor(0, 25)
        self.splitterPersos.setStretchFactor(1, 75)

        self.splitterPlot.setStretchFactor(0, 20)
        self.splitterPlot.setStretchFactor(1, 60)
        self.splitterPlot.setStretchFactor(2, 30)

        self.splitterWorld.setStretchFactor(0, 25)
        self.splitterWorld.setStretchFactor(1, 75)

        self.splitterOutlineH.setStretchFactor(0, 25)
        self.splitterOutlineH.setStretchFactor(1, 75)
        self.splitterOutlineV.setStretchFactor(0, 75)
        self.splitterOutlineV.setStretchFactor(1, 25)

        self.splitterRedacV.setStretchFactor(0, 75)
        self.splitterRedacV.setStretchFactor(1, 25)

        self.splitterRedacH.setStretchFactor(0, 30)
        self.splitterRedacH.setStretchFactor(1, 40)
        self.splitterRedacH.setStretchFactor(2, 30)

        # QFormLayout stretch
        for w in [self.txtWorldDescription, self.txtWorldPassion, self.txtWorldConflict]:
            s = w.sizePolicy()
            s.setVerticalStretch(1)
            w.setSizePolicy(s)

        # Help box
        references = [
            (self.lytTabOverview,
             self.tr("Enter infos about your book, and yourself."),
             0),
            (self.lytSituation,
             self.tr(
                     """The basic situation, in the form of a 'What if...?' question. Ex: 'What if the most dangerous
                     evil wizard could wasn't abled to kill a baby?' (Harry Potter)"""),
             1),
            (self.lytSummary,
             self.tr(
                     """Take time to think about a one sentence (~50 words) summary of your book. Then expand it to
                     a paragraph, then to a page, then to a full summary."""),
             1),
            (self.lytTabPersos,
             self.tr("Create your characters."),
             0),
            (self.lytTabPlot,
             self.tr("Develop plots."),
             0),
            (self.lytTabOutline,
             self.tr("Create the outline of your masterpiece."),
             0),
            (self.lytTabRedac,
             self.tr("Write."),
             0),
            (self.lytTabDebug,
             self.tr("Debug infos. Sometimes useful."),
             0)
        ]

        for widget, text, pos in references:
            label = helpLabel(text, self)
            self.actShowHelp.toggled.connect(label.setVisible, AUC)
            widget.layout().insertWidget(pos, label)

        self.actShowHelp.setChecked(False)

        # Spellcheck
        if enchant:
            self.menuDict = QMenu(self.tr("Dictionary"))
            self.menuDictGroup = QActionGroup(self)
            self.updateMenuDict()
            self.menuTools.addMenu(self.menuDict)

            self.actSpellcheck.toggled.connect(self.toggleSpellcheck, AUC)
            self.dictChanged.connect(self.mainEditor.setDict, AUC)
            self.dictChanged.connect(self.redacMetadata.setDict, AUC)
            self.dictChanged.connect(self.outlineItemEditor.setDict, AUC)

        else:
            # No Spell check support
            self.actSpellcheck.setVisible(False)
            a = QAction(self.tr("Install PyEnchant to use spellcheck"), self)
            a.setIcon(self.style().standardIcon(QStyle.SP_MessageBoxWarning))
            a.triggered.connect(self.openPyEnchantWebPage, AUC)
            self.menuTools.addAction(a)