当前位置: 首页>>代码示例>>Python>>正文


Python QMainWindow.show方法代码示例

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


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

示例1: test

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test(scale=0.5):
    from PyQt5.Qt import QLabel, QApplication, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
    app = QApplication([])
    mi = Metadata('xxx', ['Kovid Goyal', 'John Q. Doe', 'Author'])
    mi.series = 'A series of styles'
    m = QMainWindow()
    sa = QScrollArea(m)
    w = QWidget(m)
    sa.setWidget(w)
    l = QGridLayout(w)
    w.setLayout(l), l.setSpacing(30)
    labels = []
    for r, color in enumerate(sorted(default_color_themes)):
        for c, style in enumerate(sorted(all_styles())):
            mi.series_index = c + 1
            mi.title = 'An algorithmic cover [%s]' % color
            prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
            for x in ('cover_width', 'cover_height', 'title_font_size', 'subtitle_font_size', 'footer_font_size'):
                prefs[x] = int(scale * prefs[x])
            img = generate_cover(mi, prefs=prefs, as_qimage=True)
            la = QLabel()
            la.setPixmap(QPixmap.fromImage(img))
            l.addWidget(la, r, c)
            labels.append(la)
    m.setCentralWidget(sa)
    w.resize(w.sizeHint())
    m.show()
    app.exec_()
开发者ID:MinghuiGao,项目名称:calibre,代码行数:30,代码来源:covers.py

示例2: test

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test(scale=0.25):
    from PyQt5.Qt import QLabel, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
    from calibre.gui2 import Application
    app = Application([])
    mi = Metadata('Unknown', ['Kovid Goyal', 'John & Doe', 'Author'])
    mi.series = 'A series & styles'
    m = QMainWindow()
    sa = QScrollArea(m)
    w = QWidget(m)
    sa.setWidget(w)
    l = QGridLayout(w)
    w.setLayout(l), l.setSpacing(30)
    scale *= w.devicePixelRatioF()
    labels = []
    for r, color in enumerate(sorted(default_color_themes)):
        for c, style in enumerate(sorted(all_styles())):
            mi.series_index = c + 1
            mi.title = 'An algorithmic cover [%s]' % color
            prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
            scale_cover(prefs, scale)
            img = generate_cover(mi, prefs=prefs, as_qimage=True)
            img.setDevicePixelRatio(w.devicePixelRatioF())
            la = QLabel()
            la.setPixmap(QPixmap.fromImage(img))
            l.addWidget(la, r, c)
            labels.append(la)
    m.setCentralWidget(sa)
    w.resize(w.sizeHint())
    m.show()
    app.exec_()
开发者ID:artbycrunk,项目名称:calibre,代码行数:32,代码来源:covers.py

示例3: main

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def main():
    from calibre.gui2 import Application
    from PyQt5.Qt import QMainWindow, QStatusBar, QTimer

    app = Application([])
    w = QMainWindow()
    s = QStatusBar(w)
    w.setStatusBar(s)
    s.showMessage("Testing ProceedQuestion")
    w.show()
    p = ProceedQuestion(w)

    def doit():
        p.dummy_question()
        p.dummy_question(action_label="A very long button for testing relayout (indeed)")
        p(
            lambda p: None,
            None,
            "ass2",
            "ass2",
            "testing2",
            "testing2",
            det_msg="details shown first, with a long line to test wrapping of text and width layout",
            show_det=True,
            show_ok=True,
        )

    QTimer.singleShot(10, doit)
    app.exec_()
开发者ID:mirror,项目名称:calibre,代码行数:31,代码来源:proceed.py

示例4: main

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def main():
    from calibre.gui2 import Application
    from PyQt5.Qt import QMainWindow
    app = Application([])
    w = QMainWindow()
    w.show()
    p = ProceedQuestion(None)
    p(lambda p,q:None, None, 'ass', 'ass', 'testing', 'testing',
            checkbox_msg='testing the ruddy checkbox', det_msg='details')
    p(lambda p:None, None, 'ass2', 'ass2', 'testing2', 'testing2',
            det_msg='details shown first', show_det=True, show_ok=True,
            geom_pref='ProceedQuestion-unit-test')
    app.exec_()
开发者ID:Cykooz,项目名称:calibre,代码行数:15,代码来源:proceed.py

示例5: test

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test():
    from PyQt5.Qt import QApplication, QMainWindow
    app = QApplication([])
    w = QMainWindow()
    cf = CoverFlow()
    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())
开发者ID:BerZek,项目名称:calibre,代码行数:17,代码来源:cover_flow.py

示例6: WeirdViewClient

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
class WeirdViewClient(QMainWindow):

    """
    Weird view client initializer.
    """
    def __init__(self):
        super().__init__()
        self.device_selector_window = QMainWindow()
        self.device_selector = DeviceSelector(self.device_selector_window)
        self.device_selector.device_selection_signal.connect(self.device_open)
        self.device_selector_window.show()
        
    """
    Weird view device open callback.
    """
    def device_open(self, name, address):
        
        # Close the old device selector window.
        self.device_selector_window.close()
        self.plugin_window = QWidget()
        self.plugin = PluginWindow(self.plugin_window, name, address)
        self.plugin_window.show()
开发者ID:n3rd-bugs,项目名称:weird-rtos,代码行数:24,代码来源:weird_view_client.py

示例7: available_height

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    model = DummyImageList()
    cf.setImages(model)
    cf.setCurrentSlide(39000)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())

def main(args=sys.argv):
    return 0

if __name__ == '__main__':
    from PyQt5.Qt import QApplication, QMainWindow
    app = QApplication([])
    w = QMainWindow()
    cf = CoverFlow()
    cf.resize(int(available_width()/1.5), available_height()-60)
    w.resize(cf.size()+QSize(30, 20))
    path = sys.argv[1]
    model = FileSystemImages(sys.argv[1])
    cf.currentChanged[int].connect(model.currentChanged)
    cf.setImages(model)
    w.setCentralWidget(cf)

    w.show()
    cf.setFocus(Qt.OtherFocusReason)
    sys.exit(app.exec_())
开发者ID:BerZek,项目名称:calibre,代码行数:32,代码来源:cover_flow.py

示例8: Application

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
class Application(object):
    '''
    classdocs
    '''


    def __init__(self):
        '''
        Constructor
        '''
       # logging.config.fileConfig("logging.conf")
        self.log = logging.getLogger("Application")
        
        
        
    def setupModels(self):
        self.mongoResultModel = MongoResultModel()
        pass
    
    
    def setupSlot(self):
        self.ui_MainWindow.tableview.setModel(self.mongoResultModel)
        self.ui_MainWindow.connectBtn.clicked.connect(self.appctl.connectServer)
        
        self.ui_MainWindow.querybtn.clicked.connect(self.appctl.query)
        self.ui_MainWindow.query.returnPressed.connect(self.appctl.query)
        self.ui_MainWindow.query.textChanged.connect(self.appctl.queryChange)
        
        self.ui_MainWindow.tableview.clicked.connect(self.appctl.clickTable)
        self.add_query_action = QAction("add to query",self.ui_MainWindow.tableview)
        
        self.add_query_action.triggered.connect(self.appctl.addToQuery)
        self.ui_MainWindow.tableview.setContextMenuPolicy(Qt.ActionsContextMenu)
        self.ui_MainWindow.tableview.addAction(self.add_query_action)
        self.tableHeader = self.ui_MainWindow.tableview.horizontalHeader()
        self.tableHeader.setSortIndicatorShown(True)
        self.tableHeader.sortIndicatorChanged.connect(self.appctl.columnSort)
        
        self.ui_MainWindow.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.ui_MainWindow.treeWidget.customContextMenuRequested.connect(self.appctl.showTreeMenu)
        
        self.ui_MainWindow.prevBtn.clicked.connect(self.appctl.prevPagination)
        self.ui_MainWindow.nextBtn.clicked.connect(self.appctl.nextPagination)
        
    
    
    def setupCtl(self):
        self.appctl = AppController(self)

    
    def run(self):
        self.log.info("app is start")
        
        self.qtapp = QApplication(sys.argv)
        
        self.setupUi()
        self.setupModels()
        self.setupCtl()
        self.setupSlot()
        
        
        sys.exit(self.qtapp.exec_())
        
    def setupUi(self):
        self.mainWindow = QMainWindow()
        self.ui_MainWindow = Ui_MainWindow()
        self.ui_MainWindow.setupUi(self.mainWindow)
        self.mainWindow.show()
        pass
开发者ID:all3n,项目名称:mongo-pyqt,代码行数:71,代码来源:Application.py

示例9: isinstance

# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
            data.append(serialize_string('FOLDER', initial_folder))
    if filename:
        if isinstance(filename, bytes):
            filename = filename.decode(filesystem_encoding)
        data.append(serialize_string('FILENAME', filename))
    loop = Loop()
    h = Helper(subprocess.Popen(
        [HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
               data, loop.dialog_closed.emit)
    h.start()
    loop.exec_(QEventLoop.ExcludeUserInputEvents)
    if h.rc != 0:
        raise Exception('File dialog failed: ' + h.stderrdata.decode('utf-8'))
    if not h.stdoutdata:
        return ()
    return tuple(x.decode('utf-8') for x in h.stdoutdata.split(b'\0'))

if __name__ == '__main__':
    HELPER = sys.argv[-1]
    app = QApplication([])
    q = QMainWindow()

    def clicked():
        print(run_file_dialog(b, 'Testing dialogs', save_as=True, save_path='~/xxx.fdgdfg')), sys.stdout.flush()

    b = QPushButton('click me')
    b.clicked.connect(clicked)
    q.setCentralWidget(b)
    q.show()
    app.exec_()
开发者ID:sebaulri,项目名称:calibre,代码行数:32,代码来源:win_file_dialogs.py


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