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


Python QLineEdit.setStyleSheet方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class Edit:
   def __init__(self,label):
      height = 24
      self.key = label
      self.value = ""
      self.layout = QHBoxLayout()
      self.labl = QLabel(label)
      self.labl.setFixedHeight(height)
      self.labl.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
      self.edit = QLineEdit( )
      self.edit.setFixedHeight(height)
      self.edit.setText(self.value)
      self.edit.setStyleSheet(bgcolor(128,128,128)+fgcolor(255,255,128))
      self.edit.textChanged.connect(self.editChanged)
      self.layout.addWidget(self.labl)
      self.layout.addWidget(self.edit)

   def editChanged(self,text):
      self.value = text

   def onChangedExternally(self,text):
      self.value = text
      self.edit.setText(text)

   def addToLayout(self,l):
      l.addLayout(self.layout)
開發者ID:tweakoz,項目名稱:orkid,代碼行數:28,代碼來源:ork.assetassistant.py

示例2: initUI

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
	def initUI(self):

		# self.setStyleSheet( "background-color : grey")
		researchLabel = QLabel('Player Name')
		researchLabel.setFont( QFont("Fira Mono Bold", 11))
		researchLabel.adjustSize()
		resultsLabel = QLabel('Search results')
		resultsLabel.setFont( QFont("Fira Mono Bold", 11))
		resultsLabel.adjustSize()

		researchEdit = QLineEdit()
		researchEdit.setStyleSheet( "border : 2px solid #75FF6961; border-radius : 5px; background-color : #cbcbcb")
		researchEdit.setFont( QFont("Fira Mono Bold",12))
		researchEdit.returnPressed.connect(self.newResearch)

		grid = QGridLayout()
		grid.setSpacing(4)
		grid.addWidget(researchLabel, 1, 0)
		grid.addWidget(researchEdit, 1, 1)
		grid.addWidget(resultsLabel, 2, 0)
		self.setLayout(grid)
		# self.setGeometry(100, 100, 1000, 400)
		self.setWindowTitle('Player Searcher')
		self.show()

		self.researchEdit = researchEdit
		self.grid = grid
開發者ID:vnherdeiro,項目名稱:transfermarkt-api,代碼行數:29,代碼來源:guiSearch.py

示例3: ChoiceSection

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class ChoiceSection(QGroupBox):
    """a widget containing a read-only-field and several buttons,
    any of which can be used to make the choice, 
    which is displayed in the field & emitted as signal choice 
    """
    choice = pyqtSignal(str)
    def __init__(self, field_text, btns, parent=None, label_width = None):
        super().__init__(parent)
        self.field_text = field_text
        self.buttons = btns
        self.label_width = label_width
        self.init_UI()
         
    def init_UI(self):
        grid = QGridLayout()
        self.setLayout(grid)
        
        label = QLabel(self.field_text, self)
        if self.label_width:
            label.setMinimumWidth(self.label_width)
            label.setMaximumWidth(self.label_width)
        grid.addWidget(label, 0, 0)
        self.field = QLineEdit(self)
        self.field.setReadOnly(True)
        self.field.setStyleSheet(general.label_style_entry)
        grid.addWidget(self.field, 0, 1)
         
        self.button_dic = {}
        row = 1
         
        for (i, button) in enumerate(self.buttons):
            row += 1
            grid.addWidget(button, row, 0, 1, 2)
            self.button_dic[i] = button
         
            if i < len(self.buttons) - 1:
                row += 1
                or_lbl = QLabel("or", self)
                or_lbl.setAlignment(Qt.AlignCenter)
                grid.addWidget(or_lbl, row, 0, 1, 2)
         
        for i in self.button_dic:
            btn = self.button_dic[i]
            btn.done.connect(self.field.setText)
            btn.done.connect(self.choice.emit)
            for j in self.button_dic:
                if i != j:
                    btn2 = self.button_dic[j]
                    btn.done.connect(btn2.change_to_normal)
     
    @pyqtSlot()
    def reactivate(self):
        """returns buttons to clickme-style if they need to be re-used
        """
        for i in self.button_dic:
            btn = self.button_dic[i]
            btn.setStyleSheet(general.btn_style_clickme)
開發者ID:DKMS-LSL,項目名稱:typeloader,代碼行數:59,代碼來源:GUI_forms.py

示例4: SearchUI

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class SearchUI(QWidget):
	def __init__(self, searchFunction):
		super(SearchUI, self).__init__()

		# create objects;

		self.__ob_vlay_main = QVBoxLayout()
		self.__ob_line_main = QLineEdit()
		self.__ob_list_main = QListWidget()

		# config;

		self.setLayout(self.__ob_vlay_main)
		self.setStyleSheet("background: rgb(255, 255, 255);")

		self.__ob_line_main.setStyleSheet("border: none; background: rgb(97, 39, 171);")


	def __onLineEdit(self):
		print(self.__search(self.__ob_line_main.text()))
開發者ID:Progsapien,項目名稱:Soc,代碼行數:22,代碼來源:searchUi.py

示例5: inputPad

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class inputPad(QWidget):
	def __init__(self, window, posX = 50, posY = 50, width = 250, height = 125, title = 'input:'):
		super().__init__(window)
		self.setGeometry(posX, posY, width, height)
		
		#Set the background color
		pal = self.palette()
		pal.setColor(self.backgroundRole(), Qt.black)
		self.setPalette(pal)
		self.setAutoFillBackground(True)
		
		#Create a QLabel
		self.titleLabel = QLabel(self)
		self.titleLabel.setText(title)
		self.titleLabel.setStyleSheet('font-size: 20pt; font-family: Courier; color: red;')
		
		#Create a QLineEdit
		self.inputLine = QLineEdit(self)
		self.inputLine.setGeometry(10, 50, 100, 50)
		self.inputLine.setStyleSheet('font-size: 20pt; font-family: Courier;')
		
		#Create a QPushButton
		self.inputBtn = QPushButton('Set', self)
		self.inputBtn.setGeometry(130, 50, 100, 50)
開發者ID:AndersonPeng,項目名稱:scoreGen,代碼行數:26,代碼來源:inputPad.py

示例6: gpvdm_select

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

	def __init__(self):
		QWidget.__init__(self)
		self.hbox=QHBoxLayout()
		self.edit=QLineEdit()
		self.button=QPushButton()
		self.button.setFixedSize(25, 25)
		self.button.setText("...")
		self.hbox.addWidget(self.edit)
		self.hbox.addWidget(self.button)

		self.hbox.setContentsMargins(0, 0, 0, 0)
		self.edit.setStyleSheet("QLineEdit { border: none }");
		#self.hbox.setMargin(0)


		self.setLayout(self.hbox)
	
	def setText(self,text):
		self.edit.setText(text)
	
	def text(self):
		return self.edit.text()
開發者ID:roderickmackenzie,項目名稱:gpvdm,代碼行數:26,代碼來源:gpvdm_select.py

示例7: createEditor

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
    def createEditor(self, parent, option, index):
        self.updateRects(option, index)

        bgColor = self.bgColors.get(index, "white")

        if self.mainLineRect.contains(self.lastPos):
            # One line summary
            self.editing = Outline.summarySentence
            edt = QLineEdit(parent)
            edt.setFocusPolicy(Qt.StrongFocus)
            edt.setFrame(False)
            f = QFont(option.font)
            if self.newStyle():
                f.setBold(True)
            else:
                f.setItalic(True)
                edt.setAlignment(Qt.AlignCenter)
            edt.setPlaceholderText(self.tr("One line summary"))
            edt.setFont(f)
            edt.setStyleSheet("background: {}; color: black;".format(bgColor))
            return edt

        elif self.titleRect.contains(self.lastPos):
            # Title
            self.editing = Outline.title
            edt = QLineEdit(parent)
            edt.setFocusPolicy(Qt.StrongFocus)
            edt.setFrame(False)
            f = QFont(option.font)
            if self.newStyle():
                f.setPointSize(f.pointSize() + 4)
            else:
                edt.setAlignment(Qt.AlignCenter)
            f.setBold(True)
            edt.setFont(f)
            edt.setStyleSheet("background: {}; color: black;".format(bgColor))
            # edt.setGeometry(self.titleRect)
            return edt

        else:  # self.mainTextRect.contains(self.lastPos):
            # Summary
            self.editing = Outline.summaryFull
            edt = QPlainTextEdit(parent)
            edt.setFocusPolicy(Qt.StrongFocus)
            edt.setFrameShape(QFrame.NoFrame)
            try:
                # QPlainTextEdit.setPlaceholderText was introduced in Qt 5.3
                edt.setPlaceholderText(self.tr("Full summary"))
            except AttributeError:
                pass
            edt.setStyleSheet("background: {}; color: black;".format(bgColor))
            return edt
開發者ID:olivierkes,項目名稱:manuskript,代碼行數:54,代碼來源:corkDelegate.py

示例8: ImportPage

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

#.........這裏部分代碼省略.........
        self.importButton.clicked.connect(self.importPath)

        # Making mandatory fields:
        self.registerField("Name*", self.nameEdit)
        self.registerField("Summary*", self.summaryEdit)
        self.registerField("Version*", self.versionEdit)
        self.registerField("Release*", self.releaseEdit)
        self.registerField("License*", self.licenseEdit)
        self.registerField("Source*", self.importEdit)

        mainLayout = QVBoxLayout()
        grid = QGridLayout()
        grid.addWidget(self.importLabel, 0, 0, 1, 1)
        grid.addWidget(self.importEdit, 0, 1, 1, 1)
        grid.addWidget(self.importButton, 0, 2, 1, 1)
        grid.addWidget(self.nameLabel, 1, 0, 1, 1)
        grid.addWidget(self.nameEdit, 1, 1, 1, 3)
        grid.addWidget(self.versionLabel, 2, 0, 1, 1)
        grid.addWidget(self.versionEdit, 2, 1, 1, 3)
        grid.addWidget(self.releaseLabel, 3, 0, 1, 1)
        grid.addWidget(self.releaseEdit, 3, 1, 1, 3)
        grid.addWidget(self.licenseLabel, 4, 0, 1, 1)
        grid.addWidget(self.licenseEdit, 4, 1, 1, 3)
        grid.addWidget(self.summaryLabel, 5, 0, 1, 1)
        grid.addWidget(self.summaryEdit, 5, 1, 1, 3)
        grid.addWidget(self.URLLabel, 6, 0, 1, 1)
        grid.addWidget(self.URLEdit, 6, 1, 1, 3)
        grid.addWidget(self.descriptionLabel, 7, 0, 1, 1)
        grid.addWidget(self.descriptionEdit, 7, 1, 1, 3)
        grid.addWidget(self.vendorLabel, 8, 0, 1, 1)
        grid.addWidget(self.vendorEdit, 8, 1, 1, 3)
        grid.addWidget(self.packagerLabel, 9, 0, 1, 1)
        grid.addWidget(self.packagerEdit, 9, 1, 1, 3)
        mainLayout.addSpacing(40)
        mainLayout.addLayout(grid)
        self.setLayout(mainLayout)

    def checkPath(self):
        ''' Checks, if path to import is correct while typing'''
        path = Path(self.importEdit.text())
        if(path.exists()):
            self.importEdit.setStyleSheet("")
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")

    def importPath(self):
        ''' Returns path selected file or archive'''

        self.import_dialog = DialogImport()
        self.import_dialog.exec_()
        if (isinstance(self.import_dialog.filesSelected(), list)):
            path = self.import_dialog.filesSelected()
        else:
            path = self.import_dialog.selectedFiles()
        self.importEdit.setText(path[0])

    def validatePage(self):
        ''' [Bool] Function that invokes just after pressing the next button
            {True} - user moves to next page
            {False}- user blocked on current page
            ###### Setting up RPG class references ###### '''

        self.base.spec.tags['Name'] = self.nameEdit.text()
        self.base.spec.tags['Version'] = self.versionEdit.text()
        self.base.spec.tags['Release'] = self.releaseEdit.text()
        self.base.spec.tags['License'] = self.licenseEdit.text()
        self.base.spec.tags['URL'] = self.URLEdit.text()
        self.base.spec.tags['Summary'] = self.summaryEdit.text()
        self.base.spec.scripts['%description'] = self.descriptionEdit.text()
        self.base.spec.tags['Vendor'] = self.vendorEdit.text()
        self.base.spec.tags['Packager'] = self.packagerEdit.text()
        self.base.spec.tags['Path'] = self.importEdit.text()

        # Verifying path
        path = Path(self.base.spec.tags['Path'])
        if(path.exists()):
            self.base.process_archive_or_dir(self.base.spec.tags['Path'])
            self.base.run_raw_sources_analysis()
            self.importEdit.setStyleSheet("")
            return True
        else:
            self.importEdit.setStyleSheet("QLineEdit { border-style: solid;" +
                                          "border-width: 1px;" +
                                          "border-color: red;" +
                                          "border-radius: 3px;" +
                                          "background-color:" +
                                          "rgb(233,233,233);}")
            return False

    def nextId(self):
        ''' [int] Function that determines the next page after the current one
            - returns integer value and then checks, which value is page"
            in NUM_PAGES'''

        return Wizard.PagePatches
開發者ID:khuno,項目名稱:rpg,代碼行數:104,代碼來源:wizard.py

示例9: AddUI

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class AddUI(QWidget):
	def __init__(self, socman):
		super(AddUI, self).__init__()

		# create objects;

		self.__ob_label_title = QLabel("Заголовок, название:")
		self.__ob_label_text = QLabel("Текст, описание:")

		self.__ob_vlay_main = QVBoxLayout()

		self.__ob_line_title = QLineEdit()
		self.__ob_line_text = QTextEdit()

		self.__ob_button_add = Button("Назад")

		self.__socman = socman

		self.buttonClicked = 0

		# config;

		self.setLayout(self.__ob_vlay_main)
		self.setFixedSize(400,250)

		self.__ob_vlay_main.addWidget(self.__ob_label_title)
		self.__ob_vlay_main.addWidget(self.__ob_line_title)
		self.__ob_vlay_main.addWidget(self.__ob_label_text)
		self.__ob_vlay_main.addWidget(self.__ob_line_text)
		self.__ob_vlay_main.addWidget(self.__ob_button_add)
		self.__ob_vlay_main.setContentsMargins(0, 0, 0, 0)

		self.__ob_button_add.setFixedHeight(50)
		self.__ob_button_add.clicked.connect(self.__onButtonClicked)

		self.__ob_line_text.setStyleSheet("background: rgb(200, 200, 200); border: none;")
		self.__ob_line_title.setStyleSheet("background: rgb(200, 200, 200); border: none;")
		self.__ob_line_title.setFixedHeight(30)
		self.__ob_line_title.textChanged.connect(self.__onLinesEdit)
		self.__ob_line_text.textChanged.connect(self.__onLinesEdit)

	def __onButtonClicked(self):
		if(self.__ob_button_add.text() == "<p align='center'>Назад"):
			self.buttonClicked()
		elif(self.__ob_button_add.text() == "<p align='center'>Добавить"):
			if(self.__socman.add(self.__ob_line_title.text(), self.__ob_line_text.toPlainText())):
				self.__ob_button_add.setCurrentText("Не добавлено!")
			else:
				self.__ob_line_text.clear()
				self.__ob_line_title.clear()
				self.buttonClicked()

	def __onLinesEdit(self):
		if(len(self.__ob_line_title.text())):
			count = 0
			for i in self.__socman.getDump():
				if(self.__ob_line_title.text().upper() != i.getTitle().upper()):
					count += 1
				if(count == len(self.__socman.getDump())):
					if(len(self.__ob_line_text.toPlainText())):
						self.__ob_button_add.setCurrentText("Добавить")
					else:
						self.__ob_button_add.setCurrentText("Назад")
				else:
					self.__ob_button_add.setCurrentText("Такая запись уже существует")
		else:
			self.__ob_button_add.setCurrentText("Назад")
開發者ID:Progsapien,項目名稱:Soc,代碼行數:69,代碼來源:addUi.py

示例10: Console

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

    # signals
    newPatient = pyqtSignal()
    goTo = pyqtSignal([str])
    textEmitted = pyqtSignal([str])

    def __init__(self, parent):

        super().__init__(parent)
        self.initConsole()

    def initConsole(self):

        # vertical layout
        verticalBox = QVBoxLayout()
        verticalBox.setContentsMargins(QMargins(0, 0, 0, 0))
        verticalBox.setSpacing(0)

        # output QLabel wrapped in QScrollArea
        self.scrollArea = QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)

        self.consoleOutput = QLabel(self)
        self.consoleOutput.setStyleSheet(
            "background-color: rgb(50, 50, 50);\
             border: none;\
             color: white;\
             padding: 0;"
        )
        self.consoleOutput.setWordWrap(True)
        self.textEmitted[str].connect(self.printText)

        self.scrollArea.setWidget(self.consoleOutput)

        # input QLineEdit
        self.consoleInput = QLineEdit(self)
        self.consoleInput.setStyleSheet(
            "background-color: rgb(50, 50, 50); \
             border: none;\
             color: white;\
             padding: 0;"
        )
        self.consoleInput.setFocus()
        self.consoleInput.returnPressed.connect(self.readText)

        # adding elements to layout
        verticalBox.addWidget(self.scrollArea)
        verticalBox.addWidget(self.consoleInput)

        # setting layout
        self.setLayout(verticalBox)

    @pyqtSlot(str)
    def readText(self):
        """
        Function responsible for retreiving text from QLineEdit
        and emitting it
        """

        # retreive text
        inputText = str(self.consoleInput.text())

        # clear QLineEdit
        self.consoleInput.setText('')

        # if new patient
        if inputText == 'Nowy pacjent':
            # emit new patient signal
            self.newPatient.emit()
        elif inputText.split()[0] == 'Idź':
            self.goTo.emit(inputText.split(None, 1)[1])
        elif inputText != '':
            # emit symptoms in signal
            self.textEmitted.emit(inputText)

    @pyqtSlot(str)
    def printText(self, text):
        """
        Function responsible for printing text into QLabel
        """

        # print text in console
        textToPrint = self.consoleOutput.text() + '\n' + text
        self.consoleOutput.setText(textToPrint)

        # move slider to the bottom
        verticalScrollBar = self.scrollArea.verticalScrollBar()
        consoleOuputHeight = self.consoleOutput.geometry().height()
        verticalScrollBar.setMaximum(consoleOuputHeight)
        verticalScrollBar.setValue(verticalScrollBar.maximum())
開發者ID:wieloranski,項目名稱:experiNurse,代碼行數:93,代碼來源:console.py

示例11: AimAssist

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class AimAssist(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()
        
    def initUI(self):      
        # Buttons:
        BTN_H = 20
        BTN_W = 80
        BUTTON_COL = 0
        LABEL_COL1 = 1
        DATA_COL = 2
        RADIO_COL = 3
        
        grid = QGridLayout()
        self.setLayout(grid)
        
        # Buttons:
        acq = QPushButton("&ACK", self)
        acq.clicked.connect(self.drawRect)
        grid.addWidget(acq, 0, BUTTON_COL)
        calc = QPushButton("&Calc", self)
        calc.clicked.connect(self.solve_tank)
        grid.addWidget(calc, 1, BUTTON_COL)
        
        # Radio buttons:
        settings = QLabel("Shot Type:")
        grid.addWidget(settings, 0, RADIO_COL)
        # settings.setAlignment(Qt.AlignBottom)
        self.radNorm = QRadioButton("&Normal")
        self.radNorm.setChecked(True)
        grid.addWidget(self.radNorm, 1, RADIO_COL)
        self.radHover = QRadioButton("&Hover (Post hang only)")
        grid.addWidget(self.radHover, 2, RADIO_COL)
        self.radDig = QRadioButton("&Digger")
        grid.addWidget(self.radDig, 3, RADIO_COL)
        
        # Text areas (with labels):
        # Width
        self.wbox = QSpinBox(self)
        grid.addWidget(self.wbox, 0, DATA_COL)
        self.wbox.setMaximum(1000)
        self.wbox.setMinimum(-1000)
        wlabel = QLabel("Width:")
        grid.addWidget(wlabel, 0, LABEL_COL1)
        wlabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        # Height
        self.hbox = QSpinBox(self)
        grid.addWidget(self.hbox, 1, DATA_COL)
        self.hbox.setMaximum(1000)
        self.hbox.setMinimum(-1000)
        hlabel = QLabel("Height:")
        grid.addWidget(hlabel, 1, LABEL_COL1)
        hlabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        # Wind
        self.windbox = QSpinBox(self)
        grid.addWidget(self.windbox, 2, DATA_COL)
        self.windbox.setMaximum(30)
        self.windbox.setMinimum(-30)
        windlabel = QLabel("Wind:")
        grid.addWidget(windlabel, 2, LABEL_COL1)
        windlabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        # Angle
        self.anglebox = QSpinBox(self)
        grid.addWidget(self.anglebox, 3, DATA_COL)
        self.anglebox.setMaximum(359)
        self.anglebox.setMinimum(0)
        self.anglebox.setValue(45)
        self.anglebox.setWrapping(True)
        angleLabel = QLabel("<i>θ</i>(0-259):")
        grid.addWidget(angleLabel, 3, LABEL_COL1)
        angleLabel.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        
        # Power out:
        self.vbox = QLineEdit("Power")
        self.vbox.setStyleSheet("color: #ff0000")
        grid.addWidget(self.vbox, 2, BUTTON_COL)
        self.vbox.setAlignment(Qt.AlignRight)
        self.vbox.setReadOnly(True)
        
        self.move(50, 50)
        self.setWindowTitle('Aim Assistant')
        self.show()
        # self.setWindowFlags(Qt.WindowStaysOnTopHint)
        
    def setWH(self, rectw, recth):
        self.wbox.setValue(int(rectw))
        self.hbox.setValue(int(recth))
        self.solve_tank()
        
    def drawRect(self):
        self.lower()
        pair = Popen(["./deathmeasure"], stdout=PIPE).communicate()[0].decode('utf-8').split()
        self.setWH(pair[0], pair[1])
        # self.show()
        # self.setWindowFlags(Qt.WindowStaysOnTopHint)
        
    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Escape or e.key() == Qt.Key_Q:
            self.close()
#.........這裏部分代碼省略.........
開發者ID:calculuswhiz,項目名稱:fluffy-spoon,代碼行數:103,代碼來源:GUI.py

示例12: AddGmailAccountDialog

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
class AddGmailAccountDialog(QDialog):
    # ---------------------------------------------------------------------
    def __init__(self, parent=None):
        super(AddGmailAccountDialog, self).__init__(parent)
        # self.setAttribute(Qt.WA_DeleteOnClose)

        lbMinWidth = 150
        leMinWidth = 200

        self.isMatch = False

        # self.keyDialog.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
        self.setWindowTitle("Create a new account preset")

        baseLayout = QVBoxLayout(self)
        nameLayout = QHBoxLayout()
        keyLayout = QHBoxLayout()
        keyConfirmLayout = QHBoxLayout()

        baseLayout.addLayout(nameLayout)
        baseLayout.addLayout(keyLayout)
        baseLayout.addLayout(keyConfirmLayout)

        lb_name = QLabel('Account Preset Name: ', self)
        lb_name.setMinimumWidth(lbMinWidth)
        self.name_le = QLineEdit(self)
        self.name_le.setMinimumWidth(leMinWidth)
        nameLayout.addWidget(lb_name)
        nameLayout.addWidget(self.name_le)

        lb_key = QLabel('Encryption Key: ', self)
        lb_key.setMinimumWidth(lbMinWidth)
        self.key_le = QLineEdit(self)
        # self.key_le.setPlaceholderText('Encryption Key')
        self.key_le.setEchoMode(self.key_le.Password)
        self.key_le.setMinimumWidth(leMinWidth)
        keyLayout.addWidget(lb_key)
        keyLayout.addWidget(self.key_le)

        lb_keyConfirm = QLabel('Confirm Key: ', self)
        lb_keyConfirm.setMinimumWidth(lbMinWidth)
        self.keyConfirm_le = QLineEdit(self)
        # self.keyConfirm_le.setPlaceholderText('Encryption Key')
        self.keyConfirm_le.setEchoMode(self.key_le.Password)
        self.keyConfirm_le.setMinimumWidth(leMinWidth)
        keyConfirmLayout.addWidget(lb_keyConfirm)
        keyConfirmLayout.addWidget(self.keyConfirm_le)

        self.okBtn = QPushButton(self.tr("&Ok"))
        self.okBtn.setDefault(True)
        self.okBtn.setEnabled(False)

        cancelBtn = QPushButton(self.tr("&Cancel"))
        cancelBtn.setAutoDefault(False)

        buttonBox = QDialogButtonBox(Qt.Horizontal, self)
        buttonBox.addButton(self.okBtn, QDialogButtonBox.AcceptRole)
        buttonBox.addButton(cancelBtn, QDialogButtonBox.RejectRole)

        baseLayout.addWidget(buttonBox)

        self.name_le.textChanged.connect(self.name_confirmator)
        self.key_le.textChanged.connect(self.key_confirmator)
        self.keyConfirm_le.textChanged.connect(self.key_confirmator)

        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

    # ---------------------------------------------------------------------
    @pyqtSlot(str)
    def name_confirmator(self, name):
        if name and self.isMatch:
            self.okBtn.setEnabled(True)
        else:
            self.okBtn.setEnabled(False)

    # ---------------------------------------------------------------------
    def key_confirmator(self):
        if self.keyConfirm_le.text() == self.key_le.text():
            if not self.keyConfirm_le.text():
                self.key_le.setStyleSheet("QLineEdit {background: white;}")
                self.keyConfirm_le.setStyleSheet("QLineEdit {background: white;}")
                self.okBtn.setEnabled(False)
                self.isMatch = False
            else:
                self.key_le.setStyleSheet("QLineEdit {background: #BBFFAA;}")
                self.keyConfirm_le.setStyleSheet("QLineEdit {background: #BBFFAA;}")
                self.isMatch = True
                if self.name_le.text():
                    self.okBtn.setEnabled(True)
                else:
                    self.okBtn.setEnabled(False)
        else:
            self.key_le.setStyleSheet("QLineEdit {background: #FFAAAA;}")
            self.keyConfirm_le.setStyleSheet("QLineEdit {background: #FFAAAA;}")
            self.okBtn.setEnabled(False)
            self.isMatch = False

    # ---------------------------------------------------------------------
    @staticmethod
#.........這裏部分代碼省略.........
開發者ID:erdinc-me,項目名稱:Defter3,代碼行數:103,代碼來源:addGmailAccountDialog.py

示例13: QApplication

# 需要導入模塊: from PyQt5.QtWidgets import QLineEdit [as 別名]
# 或者: from PyQt5.QtWidgets.QLineEdit import setStyleSheet [as 別名]
		tex.clear()
		tex.setText("""The truth is out there
						Try this again""")


app = QApplication([])

window = QWidget()
window.setGeometry(500, 150, 1000, 800)
window.setWindowTitle('Парсер каналов youtube.com')
#window.setWindowIcon(QIcon('youtube.png'))
#window.frameGeometry().moveCenter(QDesktopWidget().availableGeometry().center())
window.show()

ent = QLineEdit()
ent.setStyleSheet("background-color: rgb(220, 220, 220); color: red")
ent.setText("http://www.youtube.com/watch?v=gk7X9iytuOM")
#ent.setPlaceholderText("http://www.youtube.com/watch?v=gk7X9iytuOM")

button1 = QPushButton(QIcon('youtube.png'), "Название//длительность")
button1.setToolTip("Вывод в формате: <b>Название</b> // <b>Длительность</b> // <b>Кол-во просмотров</b> // <b>Дата публикации</b>")
button1.setStatusTip('Exit application')
button1.clicked.connect(lambda: printer('usual'))

button2 = QPushButton(QIcon('dokuwiki.png'), "Список dokuwiki")
button2.setToolTip("Вывод в формате ненумерованного списка для <b>dokuwiki</b>")
button2.clicked.connect(lambda: printer('dokuwiki'))

button3 = QPushButton(QIcon('preview.png'),"dokuwiki + preview")
button3.setToolTip("Вывод в формате ненумерованного списка для <b>dokuwiki с превью</b>")
button3.clicked.connect(lambda: printer('dokuwikifull'))
開發者ID:prgmr,項目名稱:youtube_parser,代碼行數:33,代碼來源:youtube_channel_parser_pyqt.py

示例14: makePopupMenu

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

#.........這裏部分代碼省略.........
        mpr = QSignalMapper(self.menuPOV)
        for i in range(mw.mdlCharacter.rowCount()):
            a = QAction(mw.mdlCharacter.icon(i), mw.mdlCharacter.name(i), self.menuPOV)
            a.triggered.connect(mpr.map)
            mpr.setMapping(a, int(mw.mdlCharacter.ID(i)))

            imp = toInt(mw.mdlCharacter.importance(i))

            menus[2 - imp].addAction(a)

        mpr.mapped.connect(self.setPOV)
        menu.addMenu(self.menuPOV)

        # Status
        self.menuStatus = QMenu(qApp.translate("outlineBasics", "Set Status"), menu)
        # a = QAction(QIcon.fromTheme("dialog-no"), qApp.translate("outlineBasics", "None"), self.menuStatus)
        # a.triggered.connect(lambda: self.setStatus(""))
        # self.menuStatus.addAction(a)
        # self.menuStatus.addSeparator()

        mpr = QSignalMapper(self.menuStatus)
        for i in range(mw.mdlStatus.rowCount()):
            a = QAction(mw.mdlStatus.item(i, 0).text(), self.menuStatus)
            a.triggered.connect(mpr.map)
            mpr.setMapping(a, i)
            self.menuStatus.addAction(a)
        mpr.mapped.connect(self.setStatus)
        menu.addMenu(self.menuStatus)

        # Labels
        self.menuLabel = QMenu(qApp.translate("outlineBasics", "Set Label"), menu)
        mpr = QSignalMapper(self.menuLabel)
        for i in range(mw.mdlLabels.rowCount()):
            a = QAction(mw.mdlLabels.item(i, 0).icon(),
                        mw.mdlLabels.item(i, 0).text(),
                        self.menuLabel)
            a.triggered.connect(mpr.map)
            mpr.setMapping(a, i)
            self.menuLabel.addAction(a)
        mpr.mapped.connect(self.setLabel)
        menu.addMenu(self.menuLabel)

        menu.addSeparator()

        # Custom icons
        if self.menuCustomIcons:
            menu.addMenu(self.menuCustomIcons)
        else:
            self.menuCustomIcons = QMenu(qApp.translate("outlineBasics", "Set Custom Icon"), menu)
            a = QAction(qApp.translate("outlineBasics", "Restore to default"), self.menuCustomIcons)
            a.triggered.connect(lambda: self.setCustomIcon(""))
            self.menuCustomIcons.addAction(a)
            self.menuCustomIcons.addSeparator()

            txt = QLineEdit()
            txt.textChanged.connect(self.filterLstIcons)
            txt.setPlaceholderText("Filter icons")
            txt.setStyleSheet("QLineEdit { background: transparent; border: none; }")
            act = QWidgetAction(self.menuCustomIcons)
            act.setDefaultWidget(txt)
            self.menuCustomIcons.addAction(act)

            self.lstIcons = QListWidget()
            for i in customIcons():
                item = QListWidgetItem()
                item.setIcon(QIcon.fromTheme(i))
                item.setData(Qt.UserRole, i)
                item.setToolTip(i)
                self.lstIcons.addItem(item)
            self.lstIcons.itemClicked.connect(self.setCustomIconFromItem)
            self.lstIcons.setViewMode(self.lstIcons.IconMode)
            self.lstIcons.setUniformItemSizes(True)
            self.lstIcons.setResizeMode(self.lstIcons.Adjust)
            self.lstIcons.setMovement(self.lstIcons.Static)
            self.lstIcons.setStyleSheet("background: transparent; background: none;")
            self.filterLstIcons("")
            act = QWidgetAction(self.menuCustomIcons)
            act.setDefaultWidget(self.lstIcons)
            self.menuCustomIcons.addAction(act)

            menu.addMenu(self.menuCustomIcons)

        # Disabling stuff
        if not clipboard.mimeData().hasFormat("application/xml"):
            self.actPaste.setEnabled(False)

        if len(sel) == 0:
            self.actCopy.setEnabled(False)
            self.actCut.setEnabled(False)
            self.actRename.setEnabled(False)
            self.actDelete.setEnabled(False)
            self.menuPOV.setEnabled(False)
            self.menuStatus.setEnabled(False)
            self.menuLabel.setEnabled(False)
            self.menuCustomIcons.setEnabled(False)

        if len(sel) > 1:
            self.actRename.setEnabled(False)

        return menu
開發者ID:olivierkes,項目名稱:manuskript,代碼行數:104,代碼來源:outlineBasics.py

示例15: GalleryDialog

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

#.........這裏部分代碼省略.........
			return
		head, tail = os.path.split(name)
		name = os.path.join(head, tail)
		parsed = utils.title_parser(tail)
		self.title_edit.setText(parsed['title'])
		self.author_edit.setText(parsed['artist'])
		self.path_lbl.setText(name)
		l_i = self.lang_box.findText(parsed['language'])
		if l_i != -1:
			self.lang_box.setCurrentIndex(l_i)
		if gallerydb.GalleryDB.check_exists(name):
			self.file_exists_lbl.setText('<font color="red">Gallery already exists.</font>')
			self.file_exists_lbl.show()
		# check galleries
		gs = 1
		if name.endswith(utils.ARCHIVE_FILES):
			gs = len(utils.check_archive(name))
		elif os.path.isdir(name):
			g_dirs, g_archs = utils.recursive_gallery_check(name)
			gs = len(g_dirs) + len(g_archs)
		if gs == 0:
			self.file_exists_lbl.setText('<font color="red">Invalid gallery source.</font>')
			self.file_exists_lbl.show()
			self.done.hide()
		if app_constants.SUBFOLDER_AS_GALLERY:
			if gs > 1:
				self.file_exists_lbl.setText('<font color="red">More than one galleries detected in source! Use other methods to add.</font>')
				self.file_exists_lbl.show()
				self.done.hide()

	def check(self):
		if len(self.title_edit.text()) is 0:
			self.title_edit.setFocus()
			self.title_edit.setStyleSheet("border-style:outset;border-width:2px;border-color:red;")
			return False
		elif len(self.author_edit.text()) is 0:
			self.author_edit.setText("Unknown")

		if len(self.path_lbl.text()) == 0 or self.path_lbl.text() == 'No path specified':
			self.path_lbl.setStyleSheet("color:red")
			self.path_lbl.setText('No path specified')
			return False

		return True

	def set_chapters(self, gallery_object, add_to_model=True):
		path = gallery_object.path
		chap_container = gallerydb.ChaptersContainer(gallery_object)
		metafile = utils.GMetafile()
		try:
			log_d('Listing dir...')
			con = scandir.scandir(path) # list all folders in gallery dir
			log_i('Gallery source is a directory')
			log_d('Sorting')
			chapters = sorted([sub.path for sub in con if sub.is_dir() or sub.name.endswith(utils.ARCHIVE_FILES)]) #subfolders
			# if gallery has chapters divided into sub folders
			if len(chapters) != 0:
				log_d('Chapters divided in folders..')
				for ch in chapters:
					chap = chap_container.create_chapter()
					chap.title = utils.title_parser(ch)['title']
					chap.path = os.path.join(path, ch)
					metafile.update(utils.GMetafile(chap.path))
					chap.pages = len(list(scandir.scandir(chap.path)))

			else: #else assume that all images are in gallery folder
開發者ID:darmstard,項目名稱:happypanda,代碼行數:70,代碼來源:gallerydialog.py


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