當前位置: 首頁>>代碼示例>>Python>>正文


Python QLineEdit.setFixedSize方法代碼示例

本文整理匯總了Python中PyQt5.QtWidgets.QLineEdit.setFixedSize方法的典型用法代碼示例。如果您正苦於以下問題:Python QLineEdit.setFixedSize方法的具體用法?Python QLineEdit.setFixedSize怎麽用?Python QLineEdit.setFixedSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtWidgets.QLineEdit的用法示例。


在下文中一共展示了QLineEdit.setFixedSize方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: MainWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
class MainWindow(QMainWindow):

    def __init__(self, autoTradingSystem):

        super(MainWindow, self).__init__()
        self.ATM = autoTradingSystem
        self.initUI()

    def initUI(self):

        self.setStyle()
        self.setWindowTitle('Auto Trading System')
        self.initToolBar()
        self.initMenuBar()
        self.initMainBoard()
        self.techAnPage()
        #self.pairTrPage()

        # make window in center point
        self.setFixedSize(1000, 700)
        qr = self.frameGeometry()
        qr.moveCenter(QDesktopWidget().availableGeometry().center())
        self.move(qr.topLeft())

        self.show()

    def initMainBoard(self):

        self.mainBoard = QWidget()
        self.setCentralWidget(self.mainBoard)
        self.pagesStatus = [0]*5
        self.pages = [QWidget(self.mainBoard) for i in self.pagesStatus]
        self.toolButtons

        self.mainBoard.setStyleSheet(self.mainBoardQSS)
        for page in self.pages: page.setStyleSheet(self.pagesQSS)

    def initToolBar(self):

        self.toolBar = QToolBar("Tools")
        self.toolBar.setMovable(False)
        self.addToolBar(Qt.LeftToolBarArea, self.toolBar)
        self.toolBar.setIconSize(QSize(20, 20))

        self.techAnButton = QToolButton()
        self.techAnButton.setText("Technical analysis")
        self.techAnButton.setFixedSize(130, 25)
        self.pairTrButton = QToolButton()
        self.pairTrButton.setText("Pair Trading")
        self.pairTrButton.setFixedSize(130, 25)
        self.atoTrdButton = QToolButton()
        self.atoTrdButton.setText("Monitor")
        self.atoTrdButton.setFixedSize(130, 25)
        self.trdPnlButton = QToolButton()
        self.trdPnlButton.setText("PnL Report")
        self.trdPnlButton.setFixedSize(130, 25)
        self.trdHisButton = QToolButton()
        self.trdHisButton.setText("Trade History")
        self.trdHisButton.setFixedSize(130, 25)

        self.techAnButton.clicked.connect(self.techAnPage)
        self.pairTrButton.clicked.connect(self.pairTrPage)
        self.atoTrdButton.clicked.connect(self.atoTrdPage)
        self.trdPnlButton.clicked.connect(self.trdPnlPage)
        self.trdHisButton.clicked.connect(self.trdHisPage)

        self.toolBar.addWidget(self.techAnButton)
        self.toolBar.addWidget(self.pairTrButton)
        self.toolBar.addWidget(self.atoTrdButton)
        self.toolBar.addWidget(self.trdPnlButton)
        self.toolBar.addWidget(self.trdHisButton)
        self.toolButtons = [self.techAnButton, self.pairTrButton, self.atoTrdButton, self.trdPnlButton, self.trdHisButton]

    def initMenuBar(self):

        exitAction = QAction('&Exit', self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.triggered.connect(qApp.quit)

        techAnAction = QAction('&Technical Analysis', self)
        techAnAction.setShortcut('Ctrl+T')
        techAnAction.triggered.connect(self.techAnPage)
        pairTrAction = QAction('&Pair Trading', self)
        pairTrAction.setShortcut('Ctrl+P')
        pairTrAction.triggered.connect(self.pairTrPage)
        atoTrdAction = QAction('&Monitor', self)
        atoTrdAction.setShortcut('Ctrl+M')
        atoTrdAction.triggered.connect(self.atoTrdPage)
        trdPnlAction = QAction('&Profit And Loss Report', self)
        trdPnlAction.setShortcut('Ctrl+R')
        trdPnlAction.triggered.connect(self.trdPnlPage)
        trdHisAction = QAction('&Trade History', self)
        trdHisAction.setShortcut('Ctrl+H')
        trdHisAction.triggered.connect(self.trdHisPage)

        menubar = self.menuBar()
        menubar.setNativeMenuBar(False)
        fannsMenu = menubar.addMenu('&App')
        fannsMenu.addAction(exitAction)
        naviMenu = menubar.addMenu('&Navigate')
#.........這裏部分代碼省略.........
開發者ID:curme,項目名稱:AutoTrading,代碼行數:103,代碼來源:widgets.py

示例2: Layout

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]

#.........這裏部分代碼省略.........
        self.setDisabled(False)

    def infoClear(self):
            self.downloadBtn.setDisabled(True)
            self.quality.clear()
            self.quality.hide()
            self.info.clear()
            self.downloadBtn.setDisabled(True)
            self.downloadBtn.hide()

    def searchChange(self):
        searchTerm = self.searchBox.text()
        if len(searchTerm) == 0 :
            self.infoClear()
            self.searchBtn.setDisabled(True)
            self.searchBtn.setDisabled(True)
            self.statusBar().showMessage(self.statusText)
        elif len(searchTerm) != 0 :
            self.statusBar().showMessage('Kullanıma Hazır !')
            self.searchBtn.setDisabled(False)


    def toolBarButtons(self):
        # Search Button
        self.searchBtn = QPushButton(conf.app.toolBar.searchBtn.title,self)
        self.searchBtn.clicked.connect(self.getSearch)
        self.searchBtn.setDisabled(True)
        self.searchBtn.move(conf.app.toolBar.searchBtn.pos.x,conf.app.toolBar.searchBtn.pos.y)
        # Download Button
        # downloadBtn = QPushButton(conf.app.toolBar.downloadBtn.title,self)
        # downloadBtn.move(conf.app.toolBar.downloadBtn.pos.x,conf.app.toolBar.downloadBtn.pos.y)

    def toolBar(self):
        self.toolBarButtons()
        self.searchBox = QLineEdit(self)
        self.searchBox.setFocus(True)
        self.searchBox.setFixedSize(conf.app.toolBar.searchBox.size.w,conf.app.toolBar.searchBox.size.h)
        self.searchBox.setClearButtonEnabled(True)
        self.searchBox.returnPressed.connect(self.searchChange)
        self.searchBox.textEdited.connect(self.searchChange)
        self.searchBox.setPlaceholderText(conf.app.toolBar.searchBox.placeholder)
        self.searchBox.move(conf.app.toolBar.searchBox.pos.x,conf.app.toolBar.searchBox.pos.y)


    def setStatusBar(self):
        self.statusBar().showMessage(self.statusText)
        # self.downloadBtn.setDisabled(False)


    def selectedQuality(self,text):
        infoText = self.filename
        self.info.setText(infoText + ' ' + text)
        self.downloadBtn.setDisabled(False)

    def disabledAll(self):
        self.setDisabled(True)

    def enableAll(self):
        self.setEnabled(True)

    def completed(self,path):
        self.enableAll()
        self.statusBar().showMessage(conf.app.download_dir + self.filename + '.mp4 indirildi !')
        self.infoClear()
        self.searchBtn.setDisabled(True)
        self.searchBox.clear()
        self.searchBox.setFocus(True)

    def downloadVideo(self):
        self.disabledAll()
        self.statusBar().showMessage('İndiriliyor...!')
        if self.isEnabled() == False :
            video = self.yt.get(conf.app.video.type,self.quality.currentText())
            sleep(5)
            video.download(path=conf.app.download_dir,force_overwrite=True,on_finish=self.completed)


    def initUI(self):
        self.toolBar()
        self.setStatusBar()
        self.info = QLabel(self)
        self.info.move(120,50)
        self.info.setMinimumWidth(450)

        self.quality = QComboBox(self)
        self.quality.move(120,80)
        self.quality.hide()
        self.quality.activated[str].connect(self.selectedQuality)

        self.downloadBtn = QPushButton('İndir',self)
        self.downloadBtn.move(250,80)
        self.downloadBtn.setDisabled(True)
        self.downloadBtn.hide()
        self.downloadBtn.clicked.connect(self.downloadVideo)

        self.setGeometry(self.pos.x,self.pos.y,self.res.w,self.res.h)
        self.setMaximumSize(self.res.w,self.res.h)
        self.setMinimumSize(self.res.w,self.res.h)
        self.setWindowTitle(conf.app.title + " - " + conf.app.version)
        self.show()
開發者ID:ferdiunal,項目名稱:Youtube-Downloader,代碼行數:104,代碼來源:layout.py

示例3: ApplicationWindow

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
class ApplicationWindow(QtWidgets.QMainWindow):
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle("application main window")

        self.file_menu = QtWidgets.QMenu('&File', self)
        self.file_menu.addAction('&Quit', self.fileQuit,
                                 QtCore.Qt.CTRL + QtCore.Qt.Key_Q)
        self.menuBar().addMenu(self.file_menu)

        self.help_menu = QtWidgets.QMenu('&Help', self)
        self.menuBar().addSeparator()
        self.menuBar().addMenu(self.help_menu)

        self.help_menu.addAction('&About', self.about)

        self.main_widget = QtWidgets.QWidget(self)

        mainLayout = QtWidgets.QVBoxLayout(self.main_widget)

        # convas
        # dc = MyDynamicMplCanvas(self.main_widget, width=8, height=4, dpi=100)
        # mainLayout.addWidget(dc)


        hBoxLayout = QtWidgets.QHBoxLayout()

        # self.tableWidget = QTableWidget(self)
        # self.tableWidget.setRowCount(1)
        # self.tableWidget.setColumnCount(100)
        # self.tableWidget.resizeRowToContents(0)
        #self.tableWidget.setItem(0,0, QTableWidgetItem("aa"))
        #self.tableWidget.insertRow(1)

        self.listWidget = QListWidget(self)
        # self.listWidget.addItem(QListWidgetItem("3"))


        self.factorValue = QLineEdit(self)
        self.factorValue.setText("0.98")
        self.factorValue.setFixedSize(100, 30)

        self.factorButton = QPushButton(self)
        self.factorButton.setText('Change emissivity')
        self.factorButton.clicked.connect(self.factorButtonOnClicked)
        self.factorButton.setFixedSize(150, 30)

        self.stopButton = QPushButton(self)
        self.stopButton.setText('Stop')
        self.stopButton.clicked.connect(self.stopButtonOnClicked)
        self.stopButton.setFixedSize(100, 30)

        self.copyData = QPushButton(self)
        self.copyData.setText('Copy')
        self.copyData.clicked.connect(self.onCopyButtonCliced)


        self.oneMeasureButton = QPushButton(self)
        self.oneMeasureButton.setText('One Measure')
        self.oneMeasureButton.clicked.connect(self.onMeasureButtonOnClicked)


        # self.oneMeasureButton.setFixedSize(5,5)

        # self.factorMenu = QMenu(self)
        # self.factorMenu.frameSize()
        # self.factorSubMenu = self.factorMenu.addMenu("material")
        # self.factorSubMenu.addAction("new")
        # self.factorSubMenu.addAction("new2")


        spacer = QSpacerItem(500, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
        hBoxLayout.addItem(spacer)
        # hBoxLayout.addWidget(self.factorMenu)

        mainLayout.addWidget(self.listWidget)
        # mainLayout.addWidget(self.tableWidget)

        hBoxLayout.addWidget(self.copyData)
        hBoxLayout.addWidget(self.factorValue)
        hBoxLayout.addWidget(self.factorButton)
        hBoxLayout.addWidget(self.stopButton)
        hBoxLayout.addWidget(self.oneMeasureButton)

        mainLayout.addLayout(hBoxLayout)



        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

        #self.statusBar().showMessage("All hail matplotlib!", 2000)

    def stopButtonOnClicked(self):
        print("\tStop button clicked")
        connMan = PirConnManager()
        connMan.sendStopCommand()


#.........這裏部分代碼省略.........
開發者ID:slapab,項目名稱:pyrometer,代碼行數:103,代碼來源:example_gui.py

示例4: WindowHead

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
class WindowHead(QWidget):
    got_network_music_url = QtCore.pyqtSignal(str, str)

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

#        self.lab_frame = QLabel()
        self.__labWindowLogo = QLabel()
        self.__labWindowLogo.setFixedSize(30, 30)
        self.__labWindowLogo.setStyleSheet('border-image: url(Images/logo);')

        self.__lab_window_title = QLabel('<html><font color="yellow" size=4>大黃狗播放器 汪~汪~</font></html>')

        # 搜索框
        self.search_frame = QWidget()
        self.search_frame.setFixedSize(150, 18)
        self.ln_search = QLineEdit(self.search_frame)
        self.ln_search.setFixedSize(self.search_frame.size())
        self.ln_search.setPlaceholderText('輸入歌曲名')
        self.tbn_search = QToolButton(self.search_frame)
        self.tbn_search.setGeometry(128, 2, 15, 15)

        self.__tbnCloseWindow = QToolButton()
        self.__tbnMiniWindow = QToolButton()
        self.__tbnSetting = QToolButton()

        self.__tbnCloseWindow.setFixedSize(11, 11)
        self.__tbnMiniWindow.setFixedSize(11, 11)
        self.__tbnSetting.setFixedSize(11, 11)

        self.setObjectName('lab_frame')
        self.ln_search.setObjectName('ln_search')
        self.tbn_search.setObjectName('tbn_search')
        self.__tbnCloseWindow.setObjectName('closeWindow')
        self.__tbnMiniWindow.setObjectName('miniWindow')
        self.__tbnSetting.setObjectName('setting')

        self.setStyleSheet('''
            #lab_frame{background: rgba(0, 0, 0, 120);}
            #ln_search{
                border: 1px; white;
                border-radius: 9px;
                height: 18px;
            }
            #tbn_search{
                border-image: url(Images/search.png);
            }
            #closeWindow{border-image: url(Images/closeWindow);}
            #closeWindow:hover{border-image: url(Images/closeWindow_hover);}
            #miniWindow{border-image: url(Images/miniWindow);}
            #miniWindow:hover{border-image: url(Images/miniWindow_hover);}
            #setting{border-image: url(Images/setting);}
            #setting:hover{border-image: url(Images/setting_hover);}
            ''')

        self.__layout = QHBoxLayout()
        self.__layout.addWidget(self.__labWindowLogo)
        self.__layout.addStretch(5)
        self.__layout.addWidget(self.__lab_window_title)
        self.__layout.addStretch(1)
        self.__layout.addWidget(self.search_frame)
        self.__layout.addStretch(1)
        self.__layout.addWidget(self.__tbnSetting)
        self.__layout.addWidget(self.__tbnMiniWindow)
        self.__layout.addWidget(self.__tbnCloseWindow)
        self.__layout.setSpacing(10)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.__layout)

        self.network = Network.NetWork()

        self.__tbnCloseWindow.clicked.connect(self.parentWidget().close)
        self.__tbnMiniWindow.clicked.connect(self.parentWidget().showMinimized)
        self.tbn_search.clicked.connect(self.get_music_play_url)

    def get_music_play_url(self):
        music_name = self.ln_search.text()
        music_url_play_url = self.network.get_music_play_url(music_name)
        self.got_network_music_url.emit(music_name, music_url_play_url)
        print(music_url_play_url)
開發者ID:caoyanjie,項目名稱:MusicPlayer,代碼行數:82,代碼來源:WindowHead.py

示例5: EditableTabBar

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
class EditableTabBar(QTabBar):
    """ Inherits: QTabBar
        Implements editable label behaviour to tabs.
    """
    def __init__(self, parent=None):
        """ Constructor
            Params: QWidget parent -> object's parent
            Defines attributes:
                window as arg parent
                _editor as a QLineEdit object
        """
        super().__init__(parent)
        self.window = parent
        self._editor = QLineEdit(self)
        self._editor.setWindowFlags(Qt.Popup) #helps set location
        self._editor.setFocusProxy(self) #determines focus handling
        self._editor.editingFinished.connect(self.handleEditingFinished)
        self._editor.installEventFilter(self) #allows use of overloaded function eventFilter() to handle events

    def eventFilter(self, widget, event):
        """ Overloaded object method
            Params: QObject widget -> watched object (here: self)
                    QEvent event -> the event that is handled
            Return: True if the event is handled
                    Return value of QTabBar.eventFilter() if the event is not handled (bool)
            Determines editing is canceled if a click event is recorded outside of the _editor or if [esc] is pressed by hiding the _editor object.
            Else, the event is passed on to the parent class.
        """
        if ((event.type() == QEvent.MouseButtonPress and not self._editor.geometry().contains(event.globalPos())) or (event.type() == QEvent.KeyPress and event.key() == Qt.Key_Escape)):
            self._editor.hide()
            return True
        return QTabBar.eventFilter(self, widget, event)

    def mouseDoubleClickEvent(self, event):
        """ Overloaded object method
            Params: QEvent event -> the event that is handled
            Return: None
            Calls editTab() for the tab at which the double click event is recorded
        """
        index = self.tabAt(event.pos())
        if index >= 0 and self.window._styles[index]._user_style:
            self.editTab(index)

    def editTab(self, index):
        """ Object method
            Params: int index -> index of the tab to edit
            Return: None
            Sets the _editor's text, size and position to the tab label's and shows it.
        """
        rect = self.tabRect(index)
        self._editor.setFixedSize(rect.size())
        self._editor.move(self.window.mapToGlobal(rect.topLeft()))
        self._editor.setText(self.tabText(index))
        if not self._editor.isVisible():
            self._editor.show()

    def handleEditingFinished(self):
        """ Object method
            Params: None
            Return: None
            Hides the _editor and sets the entered string as the new tab label.
            Called at the automatic call of self._editor.editingFinished()
        """
        index = self.currentIndex()
        if index >= 0:
            self._editor.hide()
            new_name = self._editor.text()
            self.window._styles.rename(index, new_name)
            self.setTabText(index, new_name)
開發者ID:BAR-Rei,項目名稱:GooDoc,代碼行數:71,代碼來源:editable_tabs.py

示例6: Main

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]

#.........這裏部分代碼省略.........
        self.send.setStyleSheet('background: #6d84b4;color: white;height:40;width:70px;border-radius:3px')
        self.mesLine.addWidget(self.line)
        self.mesLine.addWidget(self.send)
        self.send.clicked.connect(self.sendmessage)
        self.line.setStyleSheet("QLineEdit{border: none;border-radius:3px;background-color:#EEE;height:40}")
        self.line.setPlaceholderText("type something ...")
        self.startmode = QPushButton('Start typing')
        self.startmode.hide()
        self.startmode.clicked.connect(self.typeracer)
        self.lay.addWidget(online)
        self.lay.addWidget(self.active)
        self.lay.addWidget(messages)
        self.lay.addWidget(self.list)
        self.lay.addLayout(self.mesLine)

    def typeracer(self):
        self.setGeometry(300, 150, 400, 650)
        self.setWindowTitle('Typeracer')
        if hasattr(self, 'lay'):
            clearLayout(self.lay)
        else:
            self.lay = QVBoxLayout()
            self.setLayout(self.lay)
        if not self.typing:
            self.typing = "Hello WOT!!!"
        self.wordslist = list(self.typing.split())
        self.mainlist = list(self.typing)
        self.words = len(list(self.typing.split()))
        self.textline = QTextEdit()
        self.textline.setText("<font color='blue' size=8>{}</font>"
                              .format(self.typing))
        self.textline.setReadOnly(True)
        self.editline = QLineEdit()
        self.editline.setFixedSize(400, 70)
        font = self.editline.font()
        font.setPointSize(18)
        self.editline.setFont(font)
        self.editline.textChanged.connect(self.sec)
        self.stopbtn = QPushButton('Stop the game')
        self.stopbtn.clicked.connect(self.result)
        self.stopbtn.hide()
        self.lay.addWidget(self.textline)
        self.lay.addWidget(self.editline)
        self.lay.addWidget(self.stopbtn)
        self.firtime = time()

    def sec(self):
        text1 = self.editline.text()
        if len(self.before) < len(text1):
            if text1[-1] == self.mainlist[0]:
                self.counter += 1
                typed = self.typing[:self.counter]
                future = self.typing[self.counter:]
                text = '''<font color='blue' size=8>{}</font>
                          <font size=8>{}</font>'''.format(typed, future)
                self.textline.setText(text)
                if self.mainlist[0] == ' ':
                    self.editline.setText('')
                    self.before = ''
                else:
                    self.countlength += 1
                    self.before = text1
                self.mainlist = self.mainlist[1:]
                if not len(self.mainlist):
                    self.result()
            else:
開發者ID:buffalobill571,項目名稱:typeracer,代碼行數:70,代碼來源:clientapp.py

示例7: SearchFrame

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
class SearchFrame(QWidget):
    add_bunch_to_list_succeed = pyqtSignal()
    listen_online_signal = pyqtSignal(str, str, str, str)
    add_to_download_signal = pyqtSignal()
    back_to_main_signal = pyqtSignal()

    def  __init__(self, parent = None):
        super(SearchFrame, self).__init__(parent)
        self.init_params()
        self.setup_ui()
        self.create_connections()
    
    def setup_ui(self):
        self.searchTable = SearchTable()
        self.searchTable.setColumnWidth(0, 39)
        self.searchTable.setColumnWidth(1, 205)
        self.searchTable.setColumnWidth(2, 180)
        self.searchTable.setColumnWidth(3, 180)
        
        self.firstPageButton = QPushButton("首頁", clicked = self.jump_to_first_page)
        self.firstPageButton.setFocusPolicy(Qt.NoFocus)
        self.firstPageButton.setFixedHeight(31)
        self.lastPageButton = QPushButton("末頁", clicked = self.jump_to_last_page)
        self.lastPageButton.setFocusPolicy(Qt.NoFocus)
        self.lastPageButton.setFixedHeight(31)
        
        self.previousPageButton = QPushButton("上一頁")
        self.previousPageButton.setFocusPolicy(Qt.NoFocus)
        self.previousPageButton.setFixedHeight(31)
        
        self.nextPageButton = QPushButton('下一頁')
        self.nextPageButton.setFocusPolicy(Qt.NoFocus)
        self.nextPageButton.setFixedHeight(31)
        
        self.jumpNum = QLineEdit('0')
        self.jumpNum.setFocusPolicy(Qt.StrongFocus)
        self.jumpNum.setFixedSize(84, 31)
        self.jumpNum.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        
        self.pageNum = QLabel("/ 0")
        self.pageNum.setFixedSize(45, 31)
        self.pageNum.setAlignment(Qt.AlignLeft | Qt.AlignVCenter )

#頁碼欄布局
        pageNumLayout = QHBoxLayout(self.jumpNum)
        pageNumLayout.addStretch()
        pageNumLayout.addWidget(self.pageNum)
        pageNumLayout.setContentsMargins(0, 0, 0, 0)
        pageNumLayout.setSpacing(0)
        pageNumLayout.setContentsMargins(0, 0, 0, 0)
        self.jumpNum.setTextMargins(0, 0, self.pageNum.width(), 0)

#綜合布局
        self.controlWidget = QWidget()
        controlLayout = QHBoxLayout(self.controlWidget)
        controlLayout.setContentsMargins(0, 0, 0, 0)
        controlLayout.setSpacing(6)
        controlLayout.addWidget(self.firstPageButton)
        controlLayout.addWidget(self.previousPageButton)
        controlLayout.addWidget(self.jumpNum)
        controlLayout.addWidget(self.nextPageButton)
        controlLayout.addWidget(self.lastPageButton)
        
        mainLayout = QVBoxLayout(self)
        mainLayout.setSpacing(7)
        mainLayout.setContentsMargins(0, 0, 0, 0)
        mainLayout.addWidget(self.searchTable)
        mainLayout.addWidget(self.controlWidget)
        
        self.currentPage = 0
        self.pages = 0
        self.currentKeyword = ''
        self.searchByType = 'all'
    
    def create_connections(self):
        self.previousPageButton.clicked.connect(self.previous_page)
        self.nextPageButton.clicked.connect(self.next_page)
        self.jumpNum.returnPressed.connect(self.go_to_page)

        self.searchTable.cellDoubleClicked.connect(self.searchtable_clicked)
        self.searchTable.cellClicked.connect(self.show_tooltip)
        self.searchTable.listenOnlineAction.triggered.connect(self.listen_online)
        self.searchTable.downloadAction.triggered.connect(self.download)
        self.searchTable.addBunchToListAction.triggered.connect(self.add_bunch_to_list)
    
    def init_params(self):
        self.downloadDir = globalSettings.DownloadfilesPath
    
    def set_download_dir(self, path):
        self.downloadDir = path
    
    def show_tooltip(self, row):
        mark = self.searchTable.item(row, 0).text()
        songName = self.searchTable.item(row, 1).text()
        artist = self.searchTable.item(row, 2).text()
        album = self.searchTable.item(row, 3).text()
        self.searchTable.setToolTip("評分:%s\n 歌曲:%s\n歌手:%s\n專輯:%s"%(mark, songName, artist, album))
    
    def listen_online(self):
        if not self.searchTable.rowCount():
#.........這裏部分代碼省略.........
開發者ID:kouxulei,項目名稱:xyplayer-package,代碼行數:103,代碼來源:search_page.py

示例8: init

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setFixedSize [as 別名]
    def init(self, filename, tab_name):
        self.vbox = QVBoxLayout()
        self.file_name = filename
        self.tab_name = tab_name

        self.tab = QGridLayout()
        widget = QWidget()
        widget.setLayout(self.tab)
        self.vbox.addWidget(widget)

        scan_remove_file(filename)

        self.edit_list = []
        inp_load_file(self.lines, filename)

        n = 0
        pos = 0
        my_token_lib = tokens()
        height = 27
        widget_number = 0
        while pos < len(self.lines):
            token = self.lines[pos]
            if token == "#ver":
                break

            if token == "#end":
                break

            if token.startswith("#"):
                show = False
                units = "Units"

                pos = pos + 1
                value = self.lines[pos]

                result = my_token_lib.find(token)
                if result != False:
                    units = result.units
                    text_info = result.info
                    show = True

                    # self.set_size_request(600,-1)
                if show == True:
                    description = QLabel()
                    description.setText(latex_to_html(text_info))

                    if result.opt[0] == "switch":
                        edit_box = gtkswitch()
                        edit_box.set_value(str2bool(value))
                        edit_box.changed.connect(functools.partial(self.callback_edit, filename, token, edit_box))
                    elif result.opt[0] == "leftright":
                        edit_box = leftright()
                        edit_box.set_value(str2bool(value))
                        edit_box.changed.connect(functools.partial(self.callback_edit, filename, token, edit_box))
                    elif result.opt[0] == "text":
                        edit_box = QLineEdit()
                        if self.editable == False:
                            edit_box.setReadOnly(True)
                        edit_box.setText(value)
                        # edit_box.set_text(self.lines[pos]);
                        edit_box.textChanged.connect(functools.partial(self.callback_edit, filename, token, edit_box))
                        # edit_box.show()
                    else:
                        edit_box = QComboBox()
                        for i in range(0, len(result.opt)):
                            edit_box.addItem(result.opt[i])

                        all_items = [edit_box.itemText(i) for i in range(edit_box.count())]
                        for i in range(0, len(all_items)):
                            if all_items[i] == token:
                                edit_box.setCurrentIndex(i)

                        edit_box.currentIndexChanged.connect(
                            functools.partial(self.callback_edit, filename, token, edit_box)
                        )

                    edit_box.setFixedSize(300, 25)
                    unit = QLabel()
                    unit.setText(latex_to_html(units))

                    self.tab.addWidget(description, widget_number, 0)
                    self.tab.addWidget(edit_box, widget_number, 1)
                    self.tab.addWidget(unit, widget_number, 2)

                    scan_item_add(filename, token, text_info, 1)

                    widget_number = widget_number + 1
            pos = pos + 1

        spacer = QWidget()
        spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.vbox.addWidget(spacer)

        self.setLayout(self.vbox)
開發者ID:roderickmackenzie,項目名稱:gpvdm,代碼行數:96,代碼來源:tab.py


注:本文中的PyQt5.QtWidgets.QLineEdit.setFixedSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。