精华内容
下载资源
问答
  • 2020-03-09 23:14:38

    python QFileidalog导入文件错误
    报错代码如下:
    path_to_file, _ = QFileDialog.getOpenFileName(self, “Load Image”, “.”, “Images (.jpg)")
    一定要加上self.ui,加上其顶层容器,改后代码为:
    path_to_file, _ = QFileDialog.getOpenFileName(self.ui, “Load Image”, “.”, "Images (
    .jpg)”)

    更多相关内容
  • Python QtWidgets.QPushButton方法代码示例

    千次阅读 2020-12-10 13:07:37
    本文整理汇总了Python中PySide2.QtWidgets.QPushButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QPushButton方法的具体用法?Python QtWidgets.QPushButton怎么用?Python QtWidgets....

    本文整理汇总了Python中PySide2.QtWidgets.QPushButton方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QPushButton方法的具体用法?Python QtWidgets.QPushButton怎么用?Python QtWidgets.QPushButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块PySide2.QtWidgets的用法示例。

    在下文中一共展示了QtWidgets.QPushButton方法的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

    示例1: __init__

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, parent=None):

    super(BrowseEdit, self).__init__(parent)

    self.text = QtWidgets.QLineEdit()

    self.text.returnPressed.connect(self.apply)

    self.button = QtWidgets.QPushButton('B')

    self.button.setFixedSize(21, 21)

    self.button.released.connect(self.browse)

    self.layout = QtWidgets.QHBoxLayout(self)

    self.layout.setContentsMargins(0, 0, 0, 0)

    self.layout.setSpacing(0)

    self.layout.addWidget(self.text)

    self.layout.addWidget(self.button)

    self._value = self.value()

    开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:18,

    示例2: __init__

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, command, parent=None):

    super(CommandDisplayDialog, self).__init__(parent)

    self.setWindowTitle("Command")

    self.text = QtWidgets.QTextEdit()

    self.text.setReadOnly(True)

    self.text.setPlainText(command)

    self.ok = QtWidgets.QPushButton('ok')

    self.ok.released.connect(self.accept)

    self.button_layout = QtWidgets.QHBoxLayout()

    self.button_layout.setContentsMargins(0, 0, 0, 0)

    self.button_layout.addStretch(1)

    self.button_layout.addWidget(self.ok)

    self.layout = QtWidgets.QVBoxLayout(self)

    self.layout.addWidget(self.text)

    self.layout.addLayout(self.button_layout)

    开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:19,

    示例3: __init__

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self):

    super(ButtonAndLongProcess, self).__init__()

    self.button = QPushButton("button")

    self.button.clicked.connect(self.buttonClicked)

    self.label = QLabel("label: before clicked")

    layout = QVBoxLayout()

    layout.addWidget(self.button)

    layout.addWidget(self.label)

    self.setLayout(layout)

    self.long_process_thread = LongProcessThread()

    self.long_process_thread.transaction.connect(self.afterLongProcess)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:18,

    示例4: __init__

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self):

    super(ButtonWithSizePolicy, self).__init__()

    button1 = QPushButton("button default")

    button2 = QPushButton("button maximum")

    button2.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)

    button3 = QPushButton("button preferred")

    button3.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)

    button4 = QPushButton("button expanding")

    button4.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)

    button5 = QPushButton("button minimum")

    button5.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)

    button6 = QPushButton("button minimum expanding")

    button6.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

    layout = QVBoxLayout()

    layout.addWidget(button1)

    layout.addWidget(button2)

    layout.addWidget(button3)

    layout.addWidget(button4)

    layout.addWidget(button5)

    layout.addWidget(button6)

    self.setLayout(layout)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:26,

    示例5: createTweetsGroupBox

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def createTweetsGroupBox(self):

    self.tweets_group_box = QtWidgets.QGroupBox("Tweets")

    self.account_address = QtWidgets.QLineEdit()

    self.fetch_button = QtWidgets.QPushButton("Fetch")

    self.add_to_bookmark_button = QtWidgets.QPushButton("Bookmark it!")

    self.connect(self.fetch_button, QtCore.SIGNAL('clicked()'), self.fetchTweets)

    self.connect(self.add_to_bookmark_button, QtCore.SIGNAL('clicked()'), self.bookmarkAddress)

    account_address_layout = QtWidgets.QHBoxLayout()

    account_address_layout.addWidget(self.account_address)

    account_address_layout.addWidget(self.fetch_button)

    account_address_layout.addWidget(self.add_to_bookmark_button)

    self.tweets_layout = QtWidgets.QVBoxLayout()

    self.tweets_main_layout = QtWidgets.QVBoxLayout()

    self.tweets_main_layout.addWidget(QtWidgets.QLabel("Address:"))

    self.tweets_main_layout.addLayout(account_address_layout)

    self.tweets_main_layout.addSpacing(20)

    self.tweets_main_layout.addLayout(self.tweets_layout)

    self.tweets_group_box.setLayout(self.tweets_main_layout)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:24,

    示例6: setupUi

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def setupUi(self, Form):

    Form.setObjectName("Form")

    Form.resize(300, 150)

    self.verticalLayout = QtWidgets.QVBoxLayout(Form)

    self.verticalLayout.setObjectName("verticalLayout")

    self.btnCreateSphere = QtWidgets.QPushButton(Form)

    self.btnCreateSphere.setObjectName("btnCreateSphere")

    self.verticalLayout.addWidget(self.btnCreateSphere)

    self.btnCallCppPlugin = QtWidgets.QPushButton(Form)

    self.btnCallCppPlugin.setObjectName("btnCallCppPlugin")

    self.verticalLayout.addWidget(self.btnCallCppPlugin)

    self.btnCallCSPlugin = QtWidgets.QPushButton(Form)

    self.btnCallCSPlugin.setObjectName("btnCallCSPlugin")

    self.verticalLayout.addWidget(self.btnCallCSPlugin)

    self.retranslateUi(Form)

    QtCore.QMetaObject.connectSlotsByName(Form)

    开发者ID:WendyAndAndy,项目名称:MayaDev,代码行数:19,

    示例7: setLang

    ​点赞 6

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def setLang(self, langName):

    uiList_lang_read = self.memoData['lang'][langName]

    for ui_name in uiList_lang_read:

    ui_element = self.uiList[ui_name]

    if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]:

    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox

    if uiList_lang_read[ui_name] != "":

    ui_element.setText(uiList_lang_read[ui_name])

    elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]:

    # uiType: QMenu, QGroupBox

    if uiList_lang_read[ui_name] != "":

    ui_element.setTitle(uiList_lang_read[ui_name])

    elif type(ui_element) in [ QtWidgets.QTabWidget]:

    # uiType: QTabWidget

    tabCnt = ui_element.count()

    if uiList_lang_read[ui_name] != "":

    tabNameList = uiList_lang_read[ui_name].split(';')

    if len(tabNameList) == tabCnt:

    for i in range(tabCnt):

    if tabNameList[i] != "":

    ui_element.setTabText(i,tabNameList[i])

    elif type(ui_element) == str:

    # uiType: string for msg

    if uiList_lang_read[ui_name] != "":

    self.uiList[ui_name] = uiList_lang_read[ui_name]

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:27,

    示例8: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, hexacolor, parent=None):

    super(ColorDialog, self).__init__(parent)

    self.setWindowFlags(QtCore.Qt.FramelessWindowHint)

    self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

    self.colorwheel = ColorWheel()

    self.colorwheel.set_current_color(QtGui.QColor(hexacolor))

    self.ok = QtWidgets.QPushButton('ok')

    self.ok.released.connect(self.accept)

    self.layout = QtWidgets.QVBoxLayout(self)

    self.layout.setContentsMargins(0, 0, 0, 0)

    self.layout.setSpacing(0)

    self.layout.addWidget(self.colorwheel)

    self.layout.addWidget(self.ok)

    开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:16,

    示例9: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self):

    super(ButtonAndLabel, self).__init__()

    self.button = QPushButton("button")

    self.button.clicked.connect(self.buttonClicked)

    self.label = QLabel("label: before clicked")

    layout = QVBoxLayout()

    layout.addWidget(self.button)

    layout.addWidget(self.label)

    self.setLayout(layout)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

    示例10: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self):

    super(ButtonAndDialog, self).__init__()

    self.button = QPushButton("button")

    self.button.clicked.connect(self.buttonClicked)

    self.label = QLabel("")

    layout = QVBoxLayout()

    layout.addWidget(self.button)

    layout.addWidget(self.label)

    self.setLayout(layout)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

    示例11: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self):

    super(ButtonAndList, self).__init__()

    self.button = QPushButton("button")

    self.button.clicked.connect(self.buttonClicked)

    self.v_layout = QVBoxLayout()

    layout = QVBoxLayout()

    layout.addWidget(self.button)

    layout.addLayout(self.v_layout)

    self.setLayout(layout)

    开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:15,

    示例12: setupUi

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def setupUi(self, Form):

    Form.setObjectName("Form")

    Form.resize(360, 180)

    self.gridLayout = QtWidgets.QGridLayout(Form)

    self.gridLayout.setObjectName("gridLayout")

    self.label_2 = QtWidgets.QLabel(Form)

    self.label_2.setObjectName("label_2")

    self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1)

    self.cbObjType = QtWidgets.QComboBox(Form)

    self.cbObjType.setObjectName("cbObjType")

    self.cbObjType.addItem("")

    self.cbObjType.addItem("")

    self.gridLayout.addWidget(self.cbObjType, 0, 1, 1, 1)

    self.btnCreate = QtWidgets.QPushButton(Form)

    self.btnCreate.setObjectName("btnCreate")

    self.gridLayout.addWidget(self.btnCreate, 0, 2, 1, 1)

    self.label = QtWidgets.QLabel(Form)

    self.label.setObjectName("label")

    self.gridLayout.addWidget(self.label, 1, 0, 1, 1)

    self.leNewName = QtWidgets.QLineEdit(Form)

    self.leNewName.setObjectName("leNewName")

    self.gridLayout.addWidget(self.leNewName, 1, 1, 1, 1)

    self.btnRename = QtWidgets.QPushButton(Form)

    self.btnRename.setObjectName("btnRename")

    self.gridLayout.addWidget(self.btnRename, 1, 2, 1, 1)

    self.retranslateUi(Form)

    QtCore.QMetaObject.connectSlotsByName(Form)

    开发者ID:WendyAndAndy,项目名称:MayaDev,代码行数:30,

    示例13: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, node):

    super().__init__()

    self.node: NetworkNode = node

    self.delete_popup = None

    self.layout = QGridLayout()

    self.table = QTableWidget(0, 3)

    self.table.setHorizontalHeaderLabels(['Id', 'Key', 'Value'])

    self.table.setColumnHidden(0, True)

    self.node.configuration.configuration_changed.connect(

    self.handle_configuration_change

    )

    self.table.cellChanged.connect(self.handle_cell_change)

    self.layout.addWidget(self.table, 0, 0, 1, 2)

    self.deleteButton = QPushButton('Remove Selected Row')

    self.deleteButton.clicked.connect(

    self.handle_delete_action

    )

    self.layout.addWidget(self.deleteButton, 1, 0)

    self.addButton = QPushButton('Add Configuration')

    self.addButton.clicked.connect(

    self.handle_add_action

    )

    self.layout.addWidget(self.addButton, 1, 1)

    self.setLayout(self.layout)

    #################################

    # Add/Update/Get for table rows #

    #################################

    开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:41,

    示例14: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, button_text: str, copy_text: str):

    super(CopyButton, self).__init__()

    self.copy_text = copy_text

    self.button_text = button_text

    self.button = QPushButton(button_text)

    # noinspection PyUnresolvedReferences

    self.button.clicked.connect(self.copy)

    self.addWidget(self.button)

    self.timer = QTimer(self.parentWidget())

    开发者ID:lightning-power-users,项目名称:node-launcher,代码行数:11,

    示例15: itemAeropython

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def itemAeropython(self):

    form = QtWidgets.QFormLayout()

    label1 = QtWidgets.QLabel(u'Angle of attack (°)')

    self.aoa = QtWidgets.QDoubleSpinBox()

    self.aoa.setSingleStep(0.1)

    self.aoa.setDecimals(1)

    self.aoa.setRange(-10.0, 10.0)

    self.aoa.setValue(0.0)

    form.addRow(label1, self.aoa)

    label2 = QtWidgets.QLabel('Freestream velocity (m/s)')

    self.freestream = QtWidgets.QDoubleSpinBox()

    self.freestream.setSingleStep(0.1)

    self.freestream.setDecimals(2)

    self.freestream.setRange(0.0, 100.0)

    self.freestream.setValue(10.0)

    form.addRow(label2, self.freestream)

    label3 = QtWidgets.QLabel('Number of panels (-)')

    self.panels = QtWidgets.QSpinBox()

    self.panels.setRange(10, 500)

    self.panels.setValue(40)

    form.addRow(label3, self.panels)

    panelMethodButton = QtWidgets.QPushButton('Calculate lift coefficient')

    form.addRow(panelMethodButton)

    self.item_ap = QtWidgets.QGroupBox('AeroPython Panel Method')

    self.item_ap.setLayout(form)

    panelMethodButton.clicked.connect(self.runPanelMethod)

    开发者ID:chiefenne,项目名称:PyAero,代码行数:35,

    示例16: itemContourAnalysis

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def itemContourAnalysis(self):

    box = QtWidgets.QVBoxLayout()

    vlayout = QtWidgets.QVBoxLayout()

    gb = QtWidgets.QGroupBox('Select contour to analyze')

    self.b1 = QtWidgets.QRadioButton('Original')

    self.b2 = QtWidgets.QRadioButton('Refined')

    self.b2.setChecked(True)

    vlayout.addWidget(self.b1)

    vlayout.addWidget(self.b2)

    gb.setLayout(vlayout)

    box.addWidget(gb)

    vlayout = QtWidgets.QVBoxLayout()

    self.cgb = QtWidgets.QGroupBox('Select plot quantity')

    self.cpb1 = QtWidgets.QRadioButton('Gradient')

    self.cpb2 = QtWidgets.QRadioButton('Curvature')

    self.cpb3 = QtWidgets.QRadioButton('Radius of Curvature')

    self.cpb1.setChecked(True)

    vlayout.addWidget(self.cpb1)

    vlayout.addWidget(self.cpb2)

    vlayout.addWidget(self.cpb3)

    self.cgb.setLayout(vlayout)

    self.cgb.setEnabled(False)

    box.addWidget(self.cgb)

    analyzeButton = QtWidgets.QPushButton('Analyze Contour')

    analyzeButton.setGeometry(10, 10, 200, 50)

    box.addWidget(analyzeButton)

    box.addStretch(1)

    self.item_ca = QtWidgets.QWidget()

    self.item_ca.setLayout(box)

    analyzeButton.clicked.connect(self.analyzeAirfoil)

    开发者ID:chiefenne,项目名称:PyAero,代码行数:39,

    示例17: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, remotePath: str, targetPath: str, isMultipleDownload: bool, parent: QObject):

    super().__init__(parent, Qt.CustomizeWindowHint | Qt.WindowTitleHint)

    self.titleLabel = QLabel(f"Downloading {remotePath} to {targetPath}")

    self.progressBar = QProgressBar()

    self.progressBar.setMinimum(0)

    self.progressBar.setMaximum(0)

    self.actualProgress = 0

    self.actualMaximum = 0

    self.isComplete = False

    self.isMultipleDownload = isMultipleDownload

    self.downloadCount = 0

    self.downloadTotal = 0

    self.progressLabel = QLabel(f"{self.downloadCount} / {self.downloadTotal} files downloaded")

    self.progressSizeLabel = QLabel("0 bytes")

    self.widgetLayout = QVBoxLayout()

    self.widgetLayout.addWidget(self.titleLabel)

    self.widgetLayout.addWidget(self.progressLabel)

    self.widgetLayout.addWidget(self.progressBar)

    self.widgetLayout.addWidget(self.progressSizeLabel)

    self.closeButton = QPushButton("Continue download in background")

    self.closeButton.clicked.connect(self.hide)

    self.widgetLayout.addWidget(self.closeButton)

    self.setLayout(self.widgetLayout)

    开发者ID:GoSecure,项目名称:pyrdp,代码行数:33,

    示例18: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__ (self, parent):

    QtWidgets.QDialog.__init__(self, parent)

    self.setWindowTitle("Export depth maps")

    self.btnQuit = QtWidgets.QPushButton("&Close")

    self.btnP1 = QtWidgets.QPushButton("&Export")

    self.pBar = QtWidgets.QProgressBar()

    self.pBar.setTextVisible(False)

    # self.selTxt =QtWidgets.QLabel()

    # self.selTxt.setText("Apply to:")

    self.radioBtn_all = QtWidgets.QRadioButton("Apply to all cameras")

    self.radioBtn_sel = QtWidgets.QRadioButton("Apply to selected")

    self.radioBtn_all.setChecked(True)

    self.radioBtn_sel.setChecked(False)

    self.formTxt = QtWidgets.QLabel()

    self.formTxt.setText("Export format:")

    self.formCmb = QtWidgets.QComboBox()

    self.formCmb.addItem("1-band F32")

    self.formCmb.addItem("Grayscale 8-bit")

    self.formCmb.addItem("Grayscale 16-bit")

    # creating layout

    layout = QtWidgets.QGridLayout()

    layout.setSpacing(10)

    layout.addWidget(self.radioBtn_all, 0, 0)

    layout.addWidget(self.radioBtn_sel, 1, 0)

    layout.addWidget(self.formTxt, 0, 1)

    layout.addWidget(self.formCmb, 1, 1)

    layout.addWidget(self.btnP1, 2, 0)

    layout.addWidget(self.btnQuit, 2, 1)

    layout.addWidget(self.pBar, 3, 0, 1, 2)

    self.setLayout(layout)

    QtCore.QObject.connect(self.btnP1, QtCore.SIGNAL("clicked()"), self.export_depth)

    QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

    self.exec()

    开发者ID:agisoft-llc,项目名称:metashape-scripts,代码行数:41,

    示例19: __init__

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def __init__(self, parent):

    QtWidgets.QDialog.__init__(self, parent)

    self.setWindowTitle("Copy bounding box")

    self.labelFrom = QtWidgets.QLabel("From")

    self.labelTo = QtWidgets.QLabel("To")

    self.fromChunk = QtWidgets.QComboBox()

    for chunk in Metashape.app.document.chunks:

    self.fromChunk.addItem(chunk.label)

    self.toChunks = QtWidgets.QListWidget()

    self.toChunks.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)

    for chunk in Metashape.app.document.chunks:

    self.toChunks.addItem(chunk.label)

    self.btnOk = QtWidgets.QPushButton("Ok")

    self.btnOk.setFixedSize(90, 50)

    self.btnOk.setToolTip("Copy bounding box to all selected chunks")

    self.btnQuit = QtWidgets.QPushButton("Close")

    self.btnQuit.setFixedSize(90, 50)

    layout = QtWidgets.QGridLayout() # creating layout

    layout.addWidget(self.labelFrom, 0, 0)

    layout.addWidget(self.fromChunk, 0, 1)

    layout.addWidget(self.labelTo, 0, 2)

    layout.addWidget(self.toChunks, 0, 3)

    layout.addWidget(self.btnOk, 1, 1)

    layout.addWidget(self.btnQuit, 1, 3)

    self.setLayout(layout)

    QtCore.QObject.connect(self.btnOk, QtCore.SIGNAL("clicked()"), self.copyBoundingBox)

    QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))

    self.exec()

    开发者ID:agisoft-llc,项目名称:metashape-scripts,代码行数:42,

    示例20: fontNormal_action

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def fontNormal_action(self, uiClass_list=[]):

    if len(uiClass_list) == 0:

    uiClass_list = 'QLabel,QPushButton'.split(',')

    self.memoData['font_size'] = self.memoData['font_size_default']

    self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:7,

    示例21: fontUp_action

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def fontUp_action(self, uiClass_list=[]):

    if len(uiClass_list) == 0:

    uiClass_list = 'QLabel,QPushButton'.split(',')

    self.memoData['font_size'] += 2

    self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:7,

    示例22: fontDown_action

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def fontDown_action(self, uiClass_list=[]):

    if len(uiClass_list) == 0:

    uiClass_list = 'QLabel,QPushButton'.split(',')

    if self.memoData['font_size'] >= self.memoData['font_size_default']:

    self.memoData['font_size'] -= 2

    self.setStyleSheet( "{0} { font-size: {1}pt;}".format(','.join(uiClass_list), self.memoData['font_size']) )

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:8,

    示例23: setLang

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def setLang(self, langName):

    lang_data = self.memoData['lang'][langName]

    for ui_name in lang_data.keys():

    if ui_name in self.uiList.keys() and lang_data[ui_name] != '':

    ui_element = self.uiList[ui_name]

    # '' means no translation availdanle in that data file

    if isinstance(ui_element, (QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox) ):

    # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox

    ui_element.setText(lang_data[ui_name])

    elif isinstance(ui_element, (QtWidgets.QGroupBox, QtWidgets.QMenu) ):

    # uiType: QMenu, QGroupBox

    ui_element.setTitle(lang_data[ui_name])

    elif isinstance(ui_element, QtWidgets.QTabWidget):

    # uiType: QTabWidget

    tabCnt = ui_element.count()

    tabNameList = lang_data[ui_name].split(';')

    if len(tabNameList) == tabCnt:

    for i in range(tabCnt):

    if tabNameList[i] != '':

    ui_element.setTabText(i,tabNameList[i])

    elif isinstance(ui_element, QtWidgets.QComboBox):

    # uiType: QComboBox

    itemCnt = ui_element.count()

    itemNameList = lang_data[ui_name].split(';')

    ui_element.clear()

    ui_element.addItems(itemNameList)

    elif isinstance(ui_element, QtWidgets.QTreeWidget):

    # uiType: QTreeWidget

    labelCnt = ui_element.headerItem().columnCount()

    labelList = lang_data[ui_name].split(';')

    ui_element.setHeaderLabels(labelList)

    elif isinstance(ui_element, QtWidgets.QTableWidget):

    # uiType: QTableWidget

    colCnt = ui_element.columnCount()

    headerList = lang_data[ui_name].split(';')

    cur_table.setHorizontalHeaderLabels( headerList )

    elif isinstance(ui_element, (str, unicode) ):

    # uiType: string for msg

    self.uiList[ui_name] = lang_data[ui_name]

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:41,

    示例24: fontNormal_action

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def fontNormal_action(self):

    self.memoData['font_size'] = self.memoData['font_size_default']

    self.setStyleSheet("QLabel,QPushButton { font-size: %dpt;}" % self.memoData['font_size'])

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:5,

    示例25: fontUp_action

    ​点赞 5

    # 需要导入模块: from PySide2 import QtWidgets [as 别名]

    # 或者: from PySide2.QtWidgets import QPushButton [as 别名]

    def fontUp_action(self):

    self.memoData['font_size'] += 2

    self.setStyleSheet("QLabel,QPushButton { font-size: %dpt;}" % self.memoData['font_size'])

    开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:5,

    注:本文中的PySide2.QtWidgets.QPushButton方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。

    展开全文
  • ‘PySide2.QtWidgets.QWidget.setFont’ called with wrong argument types: 遇到个nt问题,菜鸡本人花了半个小时 pyqt5和pyside2的差异 pyside2:先返回ok def getFont(self): ok,font= QFontDialog.getFont() if ...

    ‘PySide2.QtWidgets.QWidget.setFont’ called with wrong argument types:
    遇到个nt问题,菜鸡本人花了半个小时
    pyqt5和pyside2的差异
    pyside2:先返回ok
    def getFont(self):
    ok,font= QFontDialog.getFont()

        if ok:
            self.fontLabel.setFont(font
    

    pyqt5:先返回font
    font, ok = QFontDialog.getFont()
    if ok:
    self.fontLabel.setFont(font)

    展开全文
  • Python PyQt5.QtWidgets.QDialog() Examples

    千次阅读 2018-05-29 19:41:07
    Python PyQt5.QtWidgets.QDialog() Examples The following are 50 code examples for showing how to use PyQt5.QtWidgets.QDialog(). They are extracted from open source Python projects. You can vote up ...
    
    Python PyQt5.QtWidgets.QDialog() Examples

    The following are 50 code examples for showing how to use PyQt5.QtWidgets.QDialog(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the exmaples you don't like. You can also save this page to your account.

    + Save to library
    Example 1
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0904.py View Source Project 7 votesvote down vote up
    def setupWin(self):
            super(self.__class__,self).setupWin()
            self.setGeometry(500, 300, 250, 110) # self.resize(250,250)
            
            #------------------------------
            # template list: for frameless or always on top option
            #------------------------------
            # - template : keep ui always on top of all;
            # While in Maya, dont set Maya as its parent
            '''
            self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
            '''
            
            # - template: hide ui border frame; 
            # While in Maya, use QDialog instead, as QMainWindow will make it disappear
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            '''
            
            # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
            '''
            
            # - template: for transparent and non-regular shape ui
            # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
            # note: black color better than white for better look of semi trans edge, like pre-mutiply
            '''
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
            ''' 
    Example 2
    Project: Pyquino   Author: kmolLin   File: machine_mointor.py View Source Project 6 votesvote down vote up
    def __test__send(self):
            data = str("G29"+'\n')
            print('0')
            #if self._serial_context_.isRunning():
            print("1")
            if len(data) > 0:
                print("2")
                self._serial_context_.send(data, 0)
                print(data)
        
    
    #    def __run__(self):
     #       import sys
      #      print("123")
      #      app = QtWidgets.QApplication(sys.argv)
      #      Dialog = QtWidgets.QDialog()
      #      ui = Ui_Dialog()
      #      ui.setupUi(Dialog)
      #      Dialog.show()
      #       sys.exit(app.exec_()) 
    Example 3
    Project: scm-workbench   Author: barry-scott   File: wb_scm_app.py View Source Project 6 votesvote down vote up
    def setAppStyles( self ) -> None:
            style_sheet_pieces = self.app_style_sheet[:]
    
            # get the feedback background-color that matches a dialog background
            dialog = QtWidgets.QDialog()
            palette = dialog.palette()
            feedback_bg = palette.color( palette.Active, palette.Window ).name()
    
            style_sheet_pieces.append( 'QPlainTextEdit#feedback {background-color: %s; color: #cc00cc}' % (feedback_bg,) )
    
            style_sheet_pieces.append( 'QPlainTextEdit:read-only {background-color: %s}' % (feedback_bg,) )
            style_sheet_pieces.append( 'QLineEdit:read-only {background-color: %s}' % (feedback_bg,) )
            style_sheet_pieces.append( 'QLineEdit[valid=false] {border: 1px solid #cc00cc; border-radius: 3px; padding: 5px}' )
    
            # set the users UI font
            if self.prefs.font_ui.face is not None:
                style_sheet_pieces.append( '* { font-family: "%s"; font-size: %dpt}' % (self.prefs.font_ui.face, self.prefs.font_ui.point_size) )
    
            style_sheet = '\n'.join( style_sheet_pieces )
            self.debugLogApp( style_sheet )
            self.setStyleSheet( style_sheet ) 
    Example 4
    Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 6 votesvote down vote up
    def __init__(self, parent=None):
            QtWidgets.QDialog.__init__(self, parent, QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowCloseButtonHint)
            self.setWindowTitle("Highlighter v%s" % __version__)
            highlighter_layout = QtWidgets.QVBoxLayout()
    
            button_highlight = QtWidgets.QPushButton("&Highlight instructions")
            button_highlight.setDefault(True)
            button_highlight.clicked.connect(self.highlight)
            highlighter_layout.addWidget(button_highlight)
    
            button_clear = QtWidgets.QPushButton("&Clear all highlights")
            button_clear.clicked.connect(self.clear_colors)
            highlighter_layout.addWidget(button_clear)
    
            button_cancel = QtWidgets.QPushButton("&Close")
            button_cancel.clicked.connect(self.close)
            highlighter_layout.addWidget(button_cancel)
    
            self.setMinimumWidth(180)
            self.setLayout(highlighter_layout) 
    Example 5
    Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 6 votesvote down vote up
    def highlight(self):
            self.done(QtWidgets.QDialog.Accepted)
            highlighters = []
            if HIGHLIGHT_CALLS:
                highlighters.append(CallHighlighter(Colors.MINT))
            if HIGHLIGHT_PUSHES:
                highlighters.append(PushHighlighter(Colors.CORNFLOWER))
            if HIGHLIGHT_ANTI_VM:
                highlighters.append(AntiVmHighlighter(Colors.FLAMINGO))
            if HIGHLIGHT_ANTI_DEBUG:
                highlighters.append(AntiDebugHighlighter(Colors.FLAMINGO))
                # do this once per binary
                AntiDebugHighlighter.highlight_anti_debug_api_calls()
            if HIGHLIGHT_SUSPICIOUS_INSTRUCTIONS:
                highlighters.append(SuspicousInstructionHighlighter(Colors.FLAMINGO))
            highlight_instructions(highlighters) 
    Example 6
    Project: pisi-player   Author: mthnzbk   File: ccdialog.py View Source Project 6 votesvote down vote up
    def __init__(self, parent=None):
            super().__init__()
            self.parent = parent
            self.setVisible(False)
            self.setStyleSheet("QDialog {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                               "border-width: 1px; border-style outset; border-radius: 10px; color:white; font-weight:bold;}")
    
            layout = QHBoxLayout()
            self.setLayout(layout)
    
            label = QLabel()
            label.setStyleSheet("QLabel {color:white;}")
            label.setText("Kodlama:")
    
            layout.addWidget(label)
    
            self.combobox = QComboBox()
            self.combobox.addItems(["ISO 8859-9", "UTF-8"])
            self.combobox.setStyleSheet("QComboBox {background-color: rgba(22, 22, 22, 150); border-color:  rgba(22, 22, 22, 150);" \
                               " color:white; font-weight:bold;}")
            self.combobox.setCurrentText(settings().value("Subtitle/codec"))
    
            layout.addWidget(self.combobox)
    
            self.combobox.currentTextChanged.connect(self.textCodecChange) 
    Example 7
    Project: desktop-stream-viewer   Author: AbiosGaming   File: main.py View Source Project 6 votesvote down vote up
    def show_settings(self):
            """Shows a dialog containing settings for DSW"""
            self.dialog = QDialog(self)
            self.dialog.ui = uic.loadUi(SETTINGS_UI_FILE, self.dialog)
            self.dialog.setAttribute(QtCore.Qt.WA_DeleteOnClose)
            self.dialog.findChild(QtCore.QObject, BUTTONBOX) \
                .accepted.connect(self.generate_conf)
            if cfg[CONFIG_BUFFER_STREAM]:
                self.dialog.findChild(QtCore.QObject, RECORD_SETTINGS).setChecked(True)
            if cfg[CONFIG_MUTE]:
                self.dialog.findChild(QtCore.QObject, MUTE_SETTINGS).setChecked(True)
            self.dialog.findChild(QtCore.QObject, QUALITY_SETTINGS) \
                .setText(CONFIG_QUALITY_DELIMITER_JOIN.join(cfg[CONFIG_QUALITY]))
            self.dialog.findChild(QtCore.QObject, BUFFER_SIZE).setValue(cfg[CONFIG_BUFFER_SIZE])
            self.dialog.show() 
    Example 8
    Project: mindfulness-at-the-computer   Author: SunyataZero   File: breathing_phrase_list_wt.py View Source Project 6 votesvote down vote up
    def add_new_phrase_button_clicked(self):
            text_sg = self.add_to_list_qle.text().strip()  # strip is needed to remove a newline at the end (why?)
            if not (text_sg and text_sg.strip()):
                return
            mc.model.PhrasesM.add(
                text_sg,
                BREATHING_IN_DEFAULT_PHRASE,
                BREATHING_OUT_DEFAULT_PHRASE,
                "", ""
            )
            self.add_to_list_qle.clear()
    
            self.update_gui()
            self.list_widget.setCurrentRow(self.list_widget.count() - 1)
            # self.in_breath_phrase_qle.setFocus()
    
            # if dialog_result == QtWidgets.QDialog.Accepted:
            EditDialog.launch_edit_dialog()
            self.phrase_changed_signal.emit(True) 
    Example 9
    Project: mindfulness-at-the-computer   Author: SunyataZero   File: rest_action_list_wt.py View Source Project 6 votesvote down vote up
    def launch_edit_dialog():
            dialog = EditDialog()
            dialog_result = dialog.exec_()
    
            if dialog_result == QtWidgets.QDialog.Accepted:
                model.RestActionsM.update_title(
                    mc_global.active_rest_action_id_it,
                    dialog.rest_action_title_qle.text()
                )
                model.RestActionsM.update_rest_action_image_path(
                    mc_global.active_rest_action_id_it,
                    dialog.temporary_image_file_path_str
                )
            else:
                pass
    
            return dialog_result 
    Example 10
    Project: DCheat   Author: DCheat   File: closePopup.py View Source Project 6 votesvote down vote up
    def __init__(self, parentUi, sock, multiprocess, messgae, parent=None):
            QtWidgets.QDialog.__init__(self, parent)
            self.ui = uic.loadUi(config.config.ROOT_PATH +'view/closePopup.ui', self)
    
            self.parentUi = parentUi
            self.sock = sock
            self.mp = multiprocess
            self.closeMessage = "??? ???????.\n %d? ? ?????."
            self.message = messgae
            self.count = 10
    
            self.ui.label.setText(self.closeMessage % (self.count))
    
            self.timer = QTimer(self)
            self.timer.timeout.connect(self.message_display)
            self.timer.start(1100)
    
            self.ui.show() 
    Example 11
    Project: DCheat   Author: DCheat   File: adminSelectCourse.py View Source Project 6 votesvote down vote up
    def __init__(self, courseList, socket, parent=None):
            QtWidgets.QDialog.__init__(self, parent)
            self.ui = uic.loadUi(config.config.ROOT_PATH +'view/adminSelectCourse.ui', self)
    
            self.sock = socket
            self.courseList = []
            self.courseList = self.courseList + courseList
            self.register = object
            self.dataPos = -1
            pListWidget = QtWidgets.QWidget()
            self.ui.scrollArea.setWidgetResizable(True)
            self.ui.scrollArea.setWidget(pListWidget)
            self.pListLayout = QtWidgets.QGridLayout()
            self.pListLayout.setAlignment(Qt.AlignTop)
            pListWidget.setLayout(self.pListLayout)
    
            self.makeCourseLayout() 
    Example 12
    Project: pyENL   Author: jon85p   File: pyENL.py View Source Project 6 votesvote down vote up
    def settingsWindow(self):
            langs = {"es": 0, "en": 1, "fr": 2, "pt": 3}
            methods = {'hybr':0, 'lm':1, 'broyden1':2, 'broyden2':3, 'anderson':4,
                       'linearmixing':5, 'diagbroyden':6, 'excitingmixing':7, 'krylov':8, 'df-sane':9}
            dialog = QtWidgets.QDialog()
            dialog.ui = settings_class()
            dialog.ui.setupUi(dialog)
            # Hay que conectar ANTES de que se cierre la ventana de diálogo
            dialog.ui.buttonBox.accepted.connect(partial(self.saveSettings, dialog.ui))
            dialog.ui.comboBox.setCurrentIndex(langs[self.lang])
            dialog.ui.format_line.setText(self.format)
            dialog.ui.method_opt.setCurrentIndex(methods[self.opt_method])
            dialog.ui.tol_line.setText(str(self.opt_tol))
            dialog.ui.timeout_spin.setValue(self.timeout)
            dialog.exec_()
            dialog.show()
            # dialog.ui.buttonBox.accepted.connect(self.pruebaprint)
            # print(dir(dialog.ui.comboBox)) 
    Example 13
    Project: DownloaderForReddit   Author: MalloyDelacroix   File: FailedDownloadsDialog.py View Source Project 6 votesvote down vote up
    def __init__(self, fail_list):
            """
            A dialog box that shows the failed downloads and any relevent information about them, such as: the user that
            posted the content to reddit, the subreddit it was posted in, the title of the post, the url that failed and
            a reason as to why it failed (ex: download or extraction error)
    
            :param fail_list: A list supplied to the dialog of the failed content
            """
            QtWidgets.QDialog.__init__(self)
            self.setupUi(self)
            self.settings_manager = Core.Injector.get_settings_manager()
            geom = self.settings_manager.failed_downloads_dialog_geom
            self.restoreGeometry(geom if geom is not None else self.saveGeometry())
    
            for x in fail_list:
                self.textBrowser.append(x)
                self.textBrowser.append(' ')
    
            self.buttonBox.accepted.connect(self.accept) 
    Example 14
    Project: DownloaderForReddit   Author: MalloyDelacroix   File: AddUserDialog.py View Source Project 6 votesvote down vote up
    def __init__(self):
            """
            A dialog that opens to allow for the user to add a new reddit username to the username list. An instance of this
            class is also used as a dialog to add subreddits, but two object names are overwritten. This dialog is basically
            a standard input dialog, but with the addition of a third button that allows the user to add more than one name
            without closing the dialog.  Shortcut keys have also been added to facilitate ease of use
            """
            QtWidgets.QDialog.__init__(self)
            self.setupUi(self)
            self.settings_manager = Core.Injector.get_settings_manager()
            geom = self.settings_manager.add_user_dialog_geom
            self.restoreGeometry(geom if geom is not None else self.saveGeometry())
            self.name = None
    
            self.ok_cancel_button_box.accepted.connect(self.accept)
            self.ok_cancel_button_box.rejected.connect(self.close)
            self.add_another_button.clicked.connect(self.add_multiple) 
    Example 15
    Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
    def __init__(self):
    
            self.__dialog_ui = None  # type: QDialog
            self.complex_wave = None
    
            self.__amplitude = 0.5
            self.__frequency = 10
            self.__phase = 0
            self.__sample_rate = 1e6
            self.__num_samples = int(1e6)
    
            self.original_data = None
            self.draw_data = None
            self.position = 0
    
            super().__init__(name="InsertSine") 
    Example 16
    Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
    def dialog_ui(self) -> QDialog:
            if self.__dialog_ui is None:
                dir_name = os.path.dirname(os.readlink(__file__)) if os.path.islink(__file__) else os.path.dirname(__file__)
                self.__dialog_ui = uic.loadUi(os.path.realpath(os.path.join(dir_name, "insert_sine_dialog.ui")))
                self.__dialog_ui.setAttribute(Qt.WA_DeleteOnClose)
                self.__dialog_ui.setModal(True)
                self.__dialog_ui.doubleSpinBoxAmplitude.setValue(self.__amplitude)
                self.__dialog_ui.doubleSpinBoxFrequency.setValue(self.__frequency)
                self.__dialog_ui.doubleSpinBoxPhase.setValue(self.__phase)
                self.__dialog_ui.doubleSpinBoxSampleRate.setValue(self.__sample_rate)
                self.__dialog_ui.doubleSpinBoxNSamples.setValue(self.__num_samples)
                self.__dialog_ui.lineEditTime.setValidator(
                    QRegExpValidator(QRegExp("[0-9]+([nmµ]*|([\.,][0-9]{1,3}[nmµ]*))?$")))
    
                scene_manager = SceneManager(self.dialog_ui.graphicsViewSineWave)
                self.__dialog_ui.graphicsViewSineWave.scene_manager = scene_manager
                self.insert_indicator = scene_manager.scene.addRect(0, -2, 0, 4,
                                                                    QPen(QColor(Qt.transparent), Qt.FlatCap),
                                                                    QBrush(self.INSERT_INDICATOR_COLOR))
                self.insert_indicator.stackBefore(scene_manager.scene.selection_area)
    
                self.set_time()
    
            return self.__dialog_ui 
    Example 17
    Project: urh   Author: jopohl   File: InsertSinePlugin.py View Source Project 6 votesvote down vote up
    def get_insert_sine_dialog(self, original_data, position, sample_rate=None, num_samples=None) -> QDialog:
            self.create_dialog_connects()
            if sample_rate is not None:
                self.sample_rate = sample_rate
                self.dialog_ui.doubleSpinBoxSampleRate.setValue(sample_rate)
    
            if num_samples is not None:
                self.num_samples = int(num_samples)
                self.dialog_ui.doubleSpinBoxNSamples.setValue(num_samples)
    
            self.original_data = original_data
            self.position = position
    
            self.set_time()
            self.draw_sine_wave()
    
            return self.dialog_ui 
    Example 18
    Project: opensnitch   Author: evilsocket   File: dialog.py View Source Project 6 votesvote down vote up
    def __init__(self, app, desktop_parser, parent=None):
            self.connection = None
            QtWidgets.QDialog.__init__(self, parent,
                                       QtCore.Qt.WindowStaysOnTopHint)
            self.setupUi(self)
            self.init_widgets()
            self.start_listeners()
    
            self.connection_queue = app.connection_queue
            self.add_connection_signal.connect(self.handle_connection)
    
            self.app = app
    
            self.desktop_parser = desktop_parser
    
            self.rule_lock = threading.Lock() 
    Example 19
    Project: dayworkspace   Author: copie   File: fygui.py View Source Project 6 votesvote down vote up
    def __init__(self):
            self.app = QApplication(sys.argv)
            self.mainWindow = QMainWindow()
            self.ui = Ui_MainWindow()
            self.ui.setupUi(self.mainWindow)
    
            self.Dialog = QtWidgets.QDialog()
            self.ui2 = Ui_Form()
            self.ui2.setupUi(self.Dialog)
    
            self.ui.textEdit.setReadOnly(True)
            self.clipboard = QApplication.clipboard()
            self.clipboard.selectionChanged.connect(self.fanyi)
            self.mainWindow.setWindowTitle("????")
            self.mainWindow.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
            self.ui2.lineEdit.editingFinished.connect(self.callInput)
            self.Dialog.moveEvent = self.mainMove
            self.wordutil = wordutil()
            self.time = time.time()
            self.ui.textEdit.mouseDoubleClickEvent = self.inputText 
    Example 20
    Project: dottorrent-gui   Author: kz26   File: gui.py View Source Project 5 votesvote down vote up
    def showAboutDialog(self):
            qdlg = QtWidgets.QDialog()
            ad = Ui_AboutDialog()
            ad.setupUi(qdlg)
            ad.programVersionLabel.setText("version {}".format(__version__))
            ad.dtVersionLabel.setText("(dottorrent {})".format(
                dottorrent.__version__))
            qdlg.exec_() 
    Example 21
    Project: Recruit   Author: Weiyanyu   File: mainWIndow.py View Source Project 5 votesvote down vote up
    def outPutFile(self):
            self.Filedialog = QtWidgets.QDialog(self.centralwidget)
            self.Filedialog.setFixedSize(600,150)
            self.Filedialog.setWindowTitle('??EXCEL??')
            self.Filedialog.setModal(True)
            
    
            self.Dirlabel = QtWidgets.QLabel(self.Filedialog)
            self.Dirlabel.move(20,40)
            self.Dirlabel.setFixedSize(70,30)
            self.Dirlabel.setText('????: ')
    
            self.DirlineEdit = QtWidgets.QLineEdit(self.Filedialog)
            self.DirlineEdit.move(100,40)
            self.DirlineEdit.setFixedSize(350,30)
            self.DirlineEdit.setText(os.getcwd())
    
            self.Filelabel = QtWidgets.QLabel(self.Filedialog)
            self.Filelabel.move(20,100)
            self.Filelabel.setFixedSize(70,30)
            self.Filelabel.setText('????: ')
    
            self.FilelineEdit = QtWidgets.QLineEdit(self.Filedialog)
            self.FilelineEdit.move(100,100)
            self.FilelineEdit.setFixedSize(350,30)
    
            self.YesButton = QtWidgets.QPushButton(self.Filedialog)
            self.YesButton.move(470,100)
            self.YesButton.setFixedSize(100,30)
            self.YesButton.setText('??')
            self.YesButton.clicked.connect(self.saveFileToExcel)
    
            self.browlButton = QtWidgets.QPushButton(self.Filedialog)
            self.browlButton.move(470,40)
            self.browlButton.setFixedSize(100,30)
            self.browlButton.setText('??')
            self.browlButton.clicked.connect(self.openFile)
    
            self.Filedialog.show() 
    Example 22
    Project: rockthetaskbar   Author: jamesabel   File: helloworld.py View Source Project 5 votesvote down vote up
    def about(self):
            about_box = QDialog()
            layout = QGridLayout(about_box)
            layout.addWidget(QLabel('hello world'))
            about_box.setLayout(layout)
            about_box.show()
            about_box.exec_() 
    Example 23
    Project: Qyoutube-dl   Author: lzambella   File: MainWindowController.py View Source Project 5 votesvote down vote up
    def on_actionAbout_triggered(self):
            dialog = QDialog()
            dialog.ui = Ui_About()
            dialog.ui.setupUi(dialog)
            dialog.setAttribute(Qt.WA_DeleteOnClose)
            dialog.exec_() 
    Example 24
    Project: idapython   Author: mr-tz   File: highlight_instructions.py View Source Project 5 votesvote down vote up
    def clear_colors(self):
            self.done(QtWidgets.QDialog.Accepted)
            highlighters = []
            highlighters.append(ClearHighlighter())
            highlight_instructions(highlighters) 
    Example 25
    Project: OnCue   Author: featherbear   File: colorPicker.py View Source Project 5 votesvote down vote up
    def __init__(self, colorDict, theme=("d8d8d8", "808080", "bcbcbc")):
            QtWidgets.QDialog.__init__(self)
            self.colorDict = colorDict
            self.theme = theme
            self.colordialog = customQColorDialog()
            self.setupUi(self)
            self.setWindowTitle("Colour Picker") 
    Example 26
    Project: OnCue   Author: featherbear   File: OnCue.py View Source Project 5 votesvote down vote up
    def __init__(self, text, **kwargs):
                QtWidgets.QDialog.__init__(self)
                self.setupUi(self, text, **kwargs) 
    Example 27
    Project: VIRTUAL-PHONE   Author: SumanKanrar-IEM   File: phonebook_app.py View Source Project 5 votesvote down vote up
    def addContact(self):
            print("add contact clicked")
            QtCore.QCoreApplication.processEvents()
            os.system('python addcontact_app.py')
            # self.window = QtWidgets.QDialog()
            # self.ui = addcontact_class()
            # self.ui.setupUi(self.window)
            # self.window.show()
            #phonebook_obj.hide() 
    Example 28
    Project: VIRTUAL-PHONE   Author: SumanKanrar-IEM   File: phonebook_app.py View Source Project 5 votesvote down vote up
    def addContact(self):
            print("add contact clicked")
            QtCore.QCoreApplication.processEvents()
            os.system('python addcontact_app.py')
            # self.window = QtWidgets.QDialog()
            # self.ui = addcontact_class()
            # self.ui.setupUi(self.window)
            # self.window.show()
            #phonebook_obj.hide() 
    Example 29
    Project: cookiecutter-pyqt5   Author: mandeep   File: test_{{cookiecutter.application_name}}.py View Source Project 5 votesvote down vote up
    def test_about_dialog(window, qtbot, mock):
        """Test the About item of the Help submenu.
    
        Qtbot clicks on the help sub menu and then navigates to the About item. Mock creates
        a QDialog object to be used for the test.
        """
        qtbot.mouseClick(window.help_sub_menu, Qt.LeftButton)
        qtbot.keyClick(window.help_sub_menu, Qt.Key_Down)
        mock.patch.object(QDialog, 'exec_', return_value='accept')
        qtbot.keyClick(window.help_sub_menu, Qt.Key_Enter) 
    Example 30
    Project: doc   Author: bit-team   File: makeScreenshots.py View Source Project 5 votesvote down vote up
    def setScreenshotTimerDlg(mainWindow, dlgFunct, filename):
        def close():
            for child in mainWindow.children():
                if isinstance(child, QDialog):
                    child.close()
    
        mainWindow.hide()
    
        def moveDlg():
            for child in mainWindow.children():
                if isinstance(child, QDialog):
                    child.move(100, 50)
    
        dlgTimer = QTimer(mainWindow)
        dlgTimer.setInterval(10)
        dlgTimer.setSingleShot(True)
        dlgTimer.timeout.connect(dlgFunct)
    
        dlgMoveTimer = QTimer(mainWindow)
        dlgMoveTimer.setInterval(100)
        dlgMoveTimer.setSingleShot(True)
        dlgMoveTimer.timeout.connect(moveDlg)
    
        scrTimer = QTimer(mainWindow)
        scrTimer.setInterval(2000)
        scrTimer.setSingleShot(True)
        scrTimer.timeout.connect(lambda: takeScreenshot(filename))
    
        quitTimer = QTimer(mainWindow)
        quitTimer.setInterval(2500)
        quitTimer.setSingleShot(True)
        quitTimer.timeout.connect(close)
    
        scrTimer.start()
        quitTimer.start()
        dlgTimer.start()
        dlgMoveTimer.start()
        qapp.exec_() 
    Example 31
    Project: plexdesktop   Author: coryo   File: extra_widgets.py View Source Project 5 votesvote down vote up
    def __init__(self, media_object, parent=None):
            super().__init__(parent)
            self.setWindowTitle('Preferences')
            self.form = QtWidgets.QFormLayout(self)
            server = media_object.container.server
            settings = server.container(media_object.key)
            self.ids = []
            for item in settings['_children']:
                itype = item['type']
                if itype == 'bool':
                    input_widget = QtWidgets.QCheckBox()
                    input_widget.setCheckState(QtCore.Qt.Checked if item['value'] == 'true' else QtCore.Qt.Unchecked)
                elif itype == 'enum':
                    input_widget = QtWidgets.QComboBox()
                    input_widget.addItems(item['values'].split('|'))
                    input_widget.setCurrentIndex(int(item['value']))
                elif itype == 'text':
                    input_widget = QtWidgets.QLineEdit(item['value'])
                    if item['secure'] == 'true':
                        input_widget.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
                else:
                    input_widget = QtWidgets.QLabel('...')
                self.form.addRow(QtWidgets.QLabel(item['label']), input_widget)
                self.ids.append((item['id'], input_widget))
    
            self.buttons = QtWidgets.QDialogButtonBox(
                QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self)
            self.form.addRow(self.buttons)
            self.buttons.rejected.connect(self.reject)
            self.buttons.accepted.connect(self.accept)
            if self.exec_() == QtWidgets.QDialog.Accepted:
                media_object.container.server.request(media_object.key + '/set', params=self.extract_values()) 
    Example 32
    Project: plexdesktop   Author: coryo   File: extra_widgets.py View Source Project 5 votesvote down vote up
    def __init__(self, parent=None):
            super().__init__(parent)
            s = plexdesktop.settings.Settings()
            self.setWindowTitle('Preferences')
            self.form = QtWidgets.QFormLayout(self)
    
            i = QtWidgets.QComboBox()
            i.addItems(plexdesktop.style.Style.Instance().themes)
            i.setCurrentIndex(i.findText(s.value('theme')))
            self.form.addRow(QtWidgets.QLabel('theme'), i)
    
            bf = QtWidgets.QSpinBox()
            bf.setValue(int(s.value('browser_font', 9)))
            self.form.addRow(QtWidgets.QLabel('browser font size'), bf)
    
            icon_size = QtWidgets.QLineEdit(str(s.value('thumb_size', 240)))
            icon_size.setValidator(QtGui.QIntValidator(0, 300))
            self.form.addRow(QtWidgets.QLabel('thumbnail size'), icon_size)
    
            widget_player = QtWidgets.QCheckBox()
            widget_player.setCheckState(QtCore.Qt.Checked if bool(int(s.value('widget_player', 0))) else QtCore.Qt.Unchecked)
            self.form.addRow(QtWidgets.QLabel('use widget player'), widget_player)
    
            self.buttons = QtWidgets.QDialogButtonBox(
                QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
                QtCore.Qt.Horizontal, self)
            self.form.addRow(self.buttons)
            self.buttons.rejected.connect(self.reject)
            self.buttons.accepted.connect(self.accept)
    
            if self.exec_() == QtWidgets.QDialog.Accepted:
                # s = Settings()
                theme = i.currentText()
                s.setValue('theme', theme)
                plexdesktop.style.Style.Instance().theme(theme)
    
                s.setValue('browser_font', bf.value())
    
                s.setValue('thumb_size', int(icon_size.text()))
    
                s.setValue('widget_player', 1 if widget_player.checkState() == QtCore.Qt.Checked else 0) 
    Example 33
    Project: DGP   Author: DynamicGravitySystems   File: main.py View Source Project 5 votesvote down vote up
    def flight_info(self, item):
            data = item.getData(QtCore.Qt.UserRole)
            if isinstance(data, prj.Flight):
                dialog = QtWidgets.QDialog(self)
                dialog.setLayout(QtWidgets.QVBoxLayout())
                dialog.exec_()
                print("Flight info: {}".format(item.text()))
            else:
                print("Info event: Not a flight") 
    Example 34
    Project: DGP   Author: DynamicGravitySystems   File: splash.py View Source Project 5 votesvote down vote up
    def accept(self, project=None):
            """Runs some basic verification before calling QDialog accept()."""
    
            # Case where project object is passed to accept() (when creating new project)
            if isinstance(project, prj.GravityProject):
                self.log.debug("Opening new project: {}".format(project.name))
            elif not self.project_path:
                self.log.error("No valid project selected.")
            else:
                try:
                    project = prj.AirborneProject.load(self.project_path)
                except FileNotFoundError:
                    self.log.error("Project could not be loaded from path: {}".format(self.project_path))
                    return
    
            self.update_recent_files(self.recent_file, {project.name: project.projectdir})
            # Show a progress dialog for loading the project (as we generate plots upon load)
            progress = QtWidgets.QProgressDialog("Loading Project", "Cancel", 0, len(project), self)
            progress.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.FramelessWindowHint | QtCore.Qt.CustomizeWindowHint)
            progress.setModal(True)
            progress.setMinimumDuration(0)
            progress.setCancelButton(None)  # Remove the cancel button. Possibly add a slot that has load() check and cancel
            progress.setValue(1)  # Set an initial value to show the dialog
    
            main_window = MainWindow(project)
            main_window.status.connect(progress.setLabelText)
            main_window.progress.connect(progress.setValue)
            main_window.load()
            progress.close()  # This isn't necessary if the min/max is set correctly, but just in case.
            super().accept()
            return main_window 
    Example 35
    Project: Enibar   Author: ENIB   File: load_mail_model_window.py View Source Project 5 votesvote down vote up
    def keyPressEvent(self, event):
            """ Rewrite QDialog KeyPressEvent to enable on the fly model deletion
            """
            if event.key() == QtCore.Qt.Key_Delete:
                item = self.model_list.currentItem()
                if not item:
                    return
                if api.mail.delete_model(item.text()):
                    self.model_list.takeItem(self.model_list.row(item)) 
    Example 36
    Project: vivisect-py3   Author: bat-serjo   File: __init__.py View Source Project 5 votesvote down vote up
    def __init__(self, parent=None):
            QtWidgets.QDialog.__init__(self, parent=parent)
            self.modinfo = None
    
            self.setWindowTitle('Select a module...')
    
            vlyt = QtWidgets.QVBoxLayout()
            hlyt = QtWidgets.QHBoxLayout()
    
            self.structtree = VQStructNamespacesView(parent=self)
    
            hbox = QtWidgets.QWidget(parent=self)
    
            ok = QtWidgets.QPushButton("Ok", parent=hbox)
            cancel = QtWidgets.QPushButton("Cancel", parent=hbox)
    
            self.structtree.doubleClicked.connect(self.dialog_activated)
    
            ok.clicked.connect(self.dialog_ok)
            cancel.clicked.connect(self.dialog_cancel)
    
            hlyt.addStretch(1)
            hlyt.addWidget(cancel)
            hlyt.addWidget(ok)
            hbox.setLayout(hlyt)
    
            vlyt.addWidget(self.structtree)
            vlyt.addWidget(hbox)
            self.setLayout(vlyt)
    
            self.resize(500, 500) 
    Example 37
    Project: vivisect-py3   Author: bat-serjo   File: memsearch.py View Source Project 5 votesvote down vote up
    def main():
        app = QtWidgets.QApplication([])
        dlg = MemSearchDialog()
        font = QtWidgets.QFont('Courier')  # 'Consolas', 10)#'Courier New', 10)
        dlg.hex_edit.setFont(font)
        if dlg.exec_() == QtWidgets.QDialog.Accepted:
            print(dlg.pattern)
            print(dlg.filename) 
    Example 38
    Project: vivisect-py3   Author: bat-serjo   File: memdump.py View Source Project 5 votesvote down vote up
    def main():
        app = QtWidgets.QApplication([])
        dlg = MemDumpDialog(0x1234, '5678', 0x9ab)
        if dlg.exec_() == QtWidgets.QDialog.Accepted:
            print(dlg.filename)
            print(dlg.size) 
    Example 39
    Project: Sephrasto   Author: Aeolitus   File: CharakterMinderpaktWrapper.py View Source Project 5 votesvote down vote up
    def __init__(self):
            super().__init__()
            if Wolke.Debug:
                print("Initializing Minderpakt...")
            self.formVor = QtWidgets.QDialog()
            self.uiVor = CharakterMinderpakt.Ui_Dialog()
            self.uiVor.setupUi(self.formVor)
            self.formVor.setWindowFlags(
                    QtCore.Qt.Window |
                    QtCore.Qt.CustomizeWindowHint |
                    QtCore.Qt.WindowTitleHint |
                    QtCore.Qt.WindowCloseButtonHint)
            
            self.uiVor.treeWidget.itemSelectionChanged.connect(self.vortClicked)
            self.uiVor.treeWidget.header().setSectionResizeMode(0,1)
            if len(Wolke.Char.vorteile) > 0:
                self.currentVort = Wolke.Char.vorteile[0]
            else:
                self.currentVort = ""
            self.initVorteile()
            self.formVor.setWindowModality(QtCore.Qt.ApplicationModal)
            self.formVor.show()
            self.ret = self.formVor.exec_()
            if self.ret == QtWidgets.QDialog.Accepted:
                if self.currentVort not in Wolke.DB.vorteile:
                    self.minderpakt = None
                else:
                    self.minderpakt = self.currentVort
            else:
                self.minderpakt = None 
    Example 40
    Project: Sephrasto   Author: Aeolitus   File: DatenbankSelectTypeWrapper.py View Source Project 5 votesvote down vote up
    def __init__(self):
            super().__init__()
            Dialog = QtWidgets.QDialog()
            ui = DatenbankSelectType.Ui_Dialog()
            ui.setupUi(Dialog)
            
            Dialog.setWindowFlags(
                    QtCore.Qt.Window |
                    QtCore.Qt.CustomizeWindowHint |
                    QtCore.Qt.WindowTitleHint |
                    QtCore.Qt.WindowCloseButtonHint)
            
            Dialog.show()
            ret = Dialog.exec_()
            if ret == QtWidgets.QDialog.Accepted:
                if ui.buttonTalent.isChecked():
                    self.entryType = "Talent"
                elif ui.buttonVorteil.isChecked():
                    self.entryType = "Vorteil"
                elif ui.buttonFertigkeit.isChecked():
                    self.entryType = "Fertigkeit"
                elif ui.buttonUebernatuerlich.isChecked():
                    self.entryType = "Uebernatuerlich"
                else:
                    self.entryType = "Waffe"
            else: 
                self.entryType = None 
    Example 41
    Project: Sephrasto   Author: Aeolitus   File: DatenbankEditVorteilWrapper.py View Source Project 5 votesvote down vote up
    def __init__(self, vorteil=None):
            super().__init__()
            if vorteil is None:
                vorteil = Fertigkeiten.Vorteil()
            vorteilDialog = QtWidgets.QDialog()
            ui = DatenbankEditVorteil.Ui_talentDialog()
            ui.setupUi(vorteilDialog)
            
            vorteilDialog.setWindowFlags(
                    QtCore.Qt.Window |
                    QtCore.Qt.CustomizeWindowHint |
                    QtCore.Qt.WindowTitleHint |
                    QtCore.Qt.WindowCloseButtonHint)
            
            ui.nameEdit.setText(vorteil.name)
            ui.kostenEdit.setValue(vorteil.kosten)
            ui.comboNachkauf.setCurrentText(vorteil.nachkauf)
            ui.comboTyp.setCurrentIndex(vorteil.typ)
            ui.voraussetzungenEdit.setPlainText(Hilfsmethoden.VorArray2Str(vorteil.voraussetzungen, None))
            ui.textEdit.setPlainText(vorteil.text)
            ui.checkVariable.setChecked(vorteil.variable!=0)
            vorteilDialog.show()
            ret = vorteilDialog.exec_()
            if ret == QtWidgets.QDialog.Accepted:
                self.vorteil = Fertigkeiten.Vorteil()
                self.vorteil.name = ui.nameEdit.text()
                self.vorteil.kosten = ui.kostenEdit.value()
                self.vorteil.nachkauf = ui.comboNachkauf.currentText()
                self.vorteil.voraussetzungen = Hilfsmethoden.VorStr2Array(ui.voraussetzungenEdit.toPlainText(),None)
                self.vorteil.typ = ui.comboTyp.currentIndex()
                self.vorteil.variable = int(ui.checkVariable.isChecked())
                self.vorteil.text = ui.textEdit.toPlainText()
            else:
                self.vorteil = None 
    Example 42
    Project: pisi-player   Author: mthnzbk   File: tubedialog.py View Source Project 5 votesvote down vote up
    def __init__(self, parent=None):
            super().__init__()
            self.parent = parent
            self.resize(400, 75)
            self.setWindowFlags(Qt.Tool)
            self.move(settings().value("Youtube/position") or QPoint(250, 250))
            self.setWindowIcon(QIcon.fromTheme("pisiplayer"))
            self.setWindowTitle(self.tr("Youtube'dan Oynat"))
            self.setStyleSheet("QDialog {background-color: rgba(255, 255, 255, 200); border-color:  rgba(255, 255, 255, 200); border-width: 1px; border-style outset;}")
            self.setVisible(False)
    
            vlayout = QVBoxLayout()
            self.setLayout(vlayout)
    
            hlayout = QHBoxLayout()
            vlayout.addLayout(hlayout)
    
    
            self.tube_line = QLineEdit(self)
            self.tube_line.setMinimumHeight(30)
            self.tube_line.setStyleSheet("QLineEdit {background-color: white; color: black; border-radius: 3px;\
                                         border-color: lightgray; border-style: solid; border-width:2px;}")
            self.tube_line.setPlaceholderText("https://www.youtube.com/watch?v=mY--4-vzY6E")
            hlayout.addWidget(self.tube_line)
    
            self.tube_button = QPushButton(self)
            self.tube_button.setMinimumHeight(30)
            self.tube_button.setStyleSheet("QPushButton {background-color: #55aaff; color: white; border-width:1px; font-weight: bold; \
                                           border-color: #55aaff; border-style: solid; padding-left: 3px; padding-right: 3px; border-radius: 3px;}")
            self.tube_button.setText(self.tr("Video Oynat"))
            hlayout.addWidget(self.tube_button)
    
            self.tube_warning = QLabel(self)
            self.tube_warning.setVisible(False)
            self.tube_warning.setStyleSheet("QLabel {color: rgb(255, 0, 0); font-weight: bold; background-color: white;}")
            self.tube_warning.setText(self.tr("Verilen ba?lant? geçersiz!"))
            vlayout.addWidget(self.tube_warning)
    
            self.tube_line.returnPressed.connect(self.tube_button.animateClick)
            self.tube_button.clicked.connect(self.videoParse) 
    Example 43
    Project: unist_bb_downloader   Author: kcm4482   File: bb_downloader_mainUi.py View Source Project 5 votesvote down vote up
    def Download(self):
            import bb_downloader_downloadUi as downloadUi
            DownloadDialog = QtWidgets.QDialog(self.MainWindow)
            ui = downloadUi.Ui_DownloadDialog(DownloadDialog, self.download_list, self.account)
            ui.setupUi(DownloadDialog)
            DownloadDialog.exec_() 
    Example 44
    Project: universal_tool_template.py   Author: shiningdesign   File: UITranslator.py View Source Project 5 votesvote down vote up
    def setupUI(self):
            #------------------------------
            # main_layout auto creation for holding all the UI elements
            #------------------------------
            main_layout = None
            if isinstance(self, QtWidgets.QMainWindow):
                main_widget = QtWidgets.QWidget()
                self.setCentralWidget(main_widget)        
                main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
                main_widget.setLayout(main_layout)
            else:
                # main_layout for QDialog
                main_layout = self.quickLayout('vbox', 'main_layout')
                self.setLayout(main_layout)
    
            #------------------------------
            # user ui creation part
            #------------------------------
            # + template: qui version since universal tool template v7
            #   - no extra variable name, all text based creation and reference
            
            self.qui('dict_table | source_txtEdit | result_txtEdit','info_split;v')
            self.qui('filePath_input | fileLoad_btn;Load | fileLang_choice | fileExport_btn;Export', 'fileBtn_layout;hbox')
            
            self.qui('info_split | process_btn;Process and Update Memory From UI | fileBtn_layout', 'main_layout')
            self.uiList["source_txtEdit"].setWrap(0)
            self.uiList["result_txtEdit"].setWrap(0)
            
            #------------- end ui creation --------------------
            for name,each in self.uiList.items():
                if isinstance(each, QtWidgets.QLayout) and name!='main_layout' and not name.endswith('_grp_layout'):
                    each.setContentsMargins(0,0,0,0) # clear extra margin some nested layout
            #self.quickInfo('Ready') 
    Example 45
    Project: universal_tool_template.py   Author: shiningdesign   File: GearBox_template_1010.py View Source Project 5 votesvote down vote up
    def setupUI(self, layout='grid'):
            #------------------------------
            # main_layout auto creation for holding all the UI elements
            #------------------------------
            main_layout = None
            if isinstance(self, QtWidgets.QMainWindow):
                main_widget = QtWidgets.QWidget()
                self.setCentralWidget(main_widget)        
                main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
                main_widget.setLayout(main_layout)
            else:
                # main_layout for QDialog
                main_layout = self.quickLayout(layout, 'main_layout')
                self.setLayout(main_layout) 
    Example 46
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0904.py View Source Project 5 votesvote down vote up
    def setupUI(self, layout='grid'):
            #------------------------------
            # main_layout auto creation for holding all the UI elements
            #------------------------------
            main_layout = None
            if isinstance(self, QtWidgets.QMainWindow):
                main_widget = QtWidgets.QWidget()
                self.setCentralWidget(main_widget)        
                main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
                main_widget.setLayout(main_layout)
            else:
                # main_layout for QDialog
                main_layout = self.quickLayout(layout, 'main_layout')
                self.setLayout(main_layout) 
    Example 47
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0803.py View Source Project 5 votesvote down vote up
    def setupWin(self):
            self.setWindowTitle(self.name + " - v" + self.version + " - host: " + hostMode)
            self.setWindowIcon(self.icon)
            # initial win drag position
            self.drag_position=QtGui.QCursor.pos()
            
            self.setGeometry(500, 300, 250, 110) # self.resize(250,250)
            
            #------------------------------
            # template list: for frameless or always on top option
            #------------------------------
            # - template : keep ui always on top of all;
            # While in Maya, dont set Maya as its parent
            '''
            self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
            '''
            
            # - template: hide ui border frame; 
            # While in Maya, use QDialog instead, as QMainWindow will make it disappear
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            '''
            
            # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
            '''
            
            # - template: for transparent and non-regular shape ui
            # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
            # note: black color better than white for better look of semi trans edge, like pre-mutiply
            '''
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
            '''
            
        #############################################
        # customized SUPER quick ui function for speed up programming
        ############################################# 
    Example 48
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0903.py View Source Project 5 votesvote down vote up
    def setupUI(self):
            #------------------------------
            # main_layout auto creation for holding all the UI elements
            #------------------------------
            main_layout = None
            if isinstance(self, QtWidgets.QMainWindow):
                main_widget = QtWidgets.QWidget()
                self.setCentralWidget(main_widget)        
                main_layout = self.quickLayout('vbox', 'main_layout') # grid for auto fill window size
                main_widget.setLayout(main_layout)
            else:
                # main_layout for QDialog
                main_layout = self.quickLayout('vbox', 'main_layout')
                self.setLayout(main_layout) 
    Example 49
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_0903.py View Source Project 5 votesvote down vote up
    def setupWin(self):
            super(self.__class__,self).setupWin()
            self.setGeometry(500, 300, 250, 110) # self.resize(250,250)
            
            #------------------------------
            # template list: for frameless or always on top option
            #------------------------------
            # - template : keep ui always on top of all;
            # While in Maya, dont set Maya as its parent
            '''
            self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) 
            '''
            
            # - template: hide ui border frame; 
            # While in Maya, use QDialog instead, as QMainWindow will make it disappear
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
            '''
            
            # - template: best solution for Maya QDialog without parent, for always on-Top frameless ui
            '''
            self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint)
            '''
            
            # - template: for transparent and non-regular shape ui
            # note: use it if you set main ui to transparent, and want to use alpha png as irregular shape window
            # note: black color better than white for better look of semi trans edge, like pre-mutiply
            '''
            self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
            self.setStyleSheet("background-color: rgba(0, 0, 0,0);")
            ''' 
    Example 50
    Project: universal_tool_template.py   Author: shiningdesign   File: universal_tool_template_1010.py View Source Project 5 votesvote down vote up
    def setupUI(self, layout='grid'):
            #------------------------------
            # main_layout auto creation for holding all the UI elements
            #------------------------------
            main_layout = None
            if isinstance(self, QtWidgets.QMainWindow):
                main_widget = QtWidgets.QWidget()
                self.setCentralWidget(main_widget)        
                main_layout = self.quickLayout(layout, 'main_layout') # grid for auto fill window size
                main_widget.setLayout(main_layout)
            else:
                # main_layout for QDialog
                main_layout = self.quickLayout(layout, 'main_layout')
                self.setLayout(main_layout) 
    展开全文
  • from PyQt5 import QtWidgets [as 别名]# 或者: from PyQt5.QtWidgets import QLCDNumber [as 别名]def setupUi(self, Form):Form.setObjectName("Form")Form.resize(1053, 761)self.label = QtWidgets.QLabel(F...
  • 课程目录视频链接课程重点代码位置完整代码遇到的问题改写效果展示改写注意点改写代码(QTdesigner模式) 视频链接 P29课时30.QLabel控件的基本用法 课程重点 代码位置 完整代码 ''' QLabel控件 setAlignment...
  • 今天小编就为大家分享一篇pyqt 实现在Widgets中显示图片和文字的方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧
  • Qt Designer提供了4种窗口布局的方式: 一般布局有两种方式: 布局管理器进行布局 容器控件进行布局 1.使用布局管理器进行布局 # -*- coding: utf-8 -*- # Form implementation generated from ...
  • ") self.save_pb.setObjectName("save_pb") self.photo_lbl=QtWidgets.QLabel(Form) self.photo_lbl.setGeometry(QtCore.QRect(70, 30, 321, 251)) self.photo_lbl.setMinimumSize(QtCore.QSize(321, 251)) self....
  • 默认情况下,QLabel是不支持点击事件的,要实现QLabel的点击事件,一般有两种方式: 1、继承QLabel,重写鼠标点击事件,通过发送信号与父窗体实现通讯 ClickableLabel.hpp /*!...QLabel> #in...
  • 1.11 qt.go qlabel

    2018-12-22 16:00:36
    添加Widget界面上添加一个Label,go-uic 生成ui.go,在Ui_Form里面有Label *qtwidgets.QLabel控件,咱们就进行操作QLabel,当然一些属性在设计师里面就可以直接修改,添加. type Ui_Form struct { Label *qtwidgets....
  • QLabel是界面中的标签类,它继承自QFrame类。
  • PySide2基础篇(二)——QLabel运用

    千次阅读 多人点赞 2020-06-03 17:34:03
    PySide2基础篇(二)——QLabel运用 前言: 阅读这篇文章我能学到什么?   我们知道做窗口应用程序最基础的是掌握控件的运用。QLabel就是PySide2中一个基础的控件,它可以用于可以显示文本、图像、视频。下面让...
  • Qt学习:QLabel的用法及其程序示例

    万次阅读 2019-06-17 14:04:26
    #ifndef C_H#define C_H#include <QtWidgets/QMainWindow>#include “ui_c.h”#include <QMessageBox>#include <QLabel>#include <QPushButton>#include <QMovie>#include <QPixmap>#include <QString>...
  • PyQt5控件详解:QLabel

    2021-07-07 10:57:38
    QLabel对象作为一个占位符可以显示不可编辑的文本或图片,也可以放置一个GIF动画,还可以被用作提示标记为其他控件。纯文本、链接或富文本也可以显示在标签上。 QLabel常用方法 方法 描述 setAlignment() ...
  • PyQt5 实现音乐播放器界面

    千次阅读 热门讨论 2020-03-29 09:35:53
    主要参考来源 在PyQt5中美化和装扮图形界面 相对的增加了拖动和关闭按钮执行函数。 全部代码如下: # marsmarcin ...from PyQt5 import QtCore,QtGui,QtWidgets import sys import qtawesome class M...
  • //得到每个字符的宽度 QString elideNote = fontWidth.elidedText(strText, Qt::ElideRight, ui.label->width() * 2); ui.label->setText(elideNote); 所以最好能够自己实现,废话不说,直接上代码 QString ...
  • 虽然Qt提供了不少现成的组件,但是在Python中使用PyQt5或PySide2进行图形界面程序开发的过程,还是免不了要根据自己的需求组合一些小部件以形成新的自定义组件。最近州的先生在写一个桌面图形界面的登录密码框的过程...
  • QT Designer中Qlabel怎么改变字体大小

    千次阅读 2021-02-21 17:50:02
    自己刚用QT Designer,在找QLabel的字体的时候都找了半天,特此记录
  • self.label = QtWidgets.QLabel(Form) self.label.setObjectName("label") self.gridLayout_2.addWidget(self.label, 0, 0, 1, 1) self.lineEdit = QtWidgets.QLineEdit(Form) self.lineEdit.setObjectName...
  • I have a Qlabel filled with QPixmap and I want to start a process/function once this label ... I had extended QLabel class as follows:from PyQt5.QtCore import *from PyQt5.QtWidgets import *from P...
  • QT += widgets Inherits QFrame Inherited By 详细说明 QLabel用于显示文本或图像。不提供用户交互功能。标签的视觉外观可以以各种方式配置,并且可以用于为另一个小部件指定焦点助记键。 Q
  • 从零开始学Pyqt5之【控件介绍】(1):QLabel控件QLabel控件的作用QLabel控件常用的方法QLabel控件常用的信号QLabel显示的代码演示 QLabel控件的作用 QLabel控件一般用作显示不可编辑的...from PyQt5.QtWidgets impo
  • 应用场景 ...from PySide2.QtWidgets import QApplication, QWidget, QLabel class CameraViewer(QLabel): sig = None def setSig(self, sig): self.sig = sig # 鼠标点击事件 def mousePr
  • python2.7 安装pyqt5 解决QtWidgets等报错

    千次阅读 2018-09-18 19:19:22
    链接:...   1.pip install python-qt5 2.下载链接里面的内容,把Lib/site-packages下的PyQt5放到python2.7安装目录下的Lib/site-packages,这个是别人编译好的pyqt5   # coding=utf-8 impo...
  • from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QLabel, QPushButton, QVBoxLayout, QHBoxLayout from PyQt5.QtGui import QPixmap, QPalette # 图片 调色板 from PyQt5.QtCore import Qt # 常量...
  • Python可视化界面编程入门具体实现代码如所示:(1)普通可视化界面编程代码入门:import sysfrom PyQt5.QtWidgets import QWidget,QApplication #导入两个类来进行程序界面编程if __name__=="__main__":#创建一个...
  • 掌握QLabel的使用目的是为了把图片加载出来,并且通过与按钮的槽函数绑定,实现识别功能启动。 ''' QLabel控件 setAlignment():设置文本的对齐方式 setIndent():设置文本缩进 text():获取文本内容 setBuddy()...
  • self.locationLabel2 = QtWidgets.QLabel(MainWindow); self.locationLabel2.setText('定时器范围\n红色下拉框\n单位秒') self.locationLabel2.setStyleSheet( "QLabel{width: 15px;color:#0000ff;font: normal ...
  • from PyQt5 importQtCore, QtGui, QtWidgetsclassUi_MainWindow(object):defsetupUi(self, MainWindow):MainWindow.setObjectName("MainWindow")MainWindow.resize(453, 372)self.centralWidget=QtWidgets.QWidget(M...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 9,522
精华内容 3,808
关键字:

qtwidgets.qlabel