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


Python QGridLayout.addWidget方法代码示例

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


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

示例1: GusHardwareOptions

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class GusHardwareOptions(QWidget):
    def __init__(self, parent, name="GusHardwareOptions"):
        QWidget.__init__(self, parent, name)
        numrows = 2
        numcols = 3
        margin = 0
        space = 1
        self.grid = QGridLayout(self, numrows, numcols, margin, space, "GusHardwareOptionsLayout")
        self.base_box = ConfigSpinWidget(self, "I/O address", max=1000)
        self.grid.addWidget(self.base_box, 0, 0)
        self.irq1_box = ConfigSpinWidget(self, "IRQ 1", min=3, max=15)
        self.grid.addWidget(self.irq1_box, 0, 1)
        self.irq2_box = ConfigSpinWidget(self, "IRQ 2", min=3, max=15)
        self.grid.addWidget(self.irq2_box, 1, 1)
        self.dma1_box = ConfigSpinWidget(self, "DMA 1")
        self.grid.addWidget(self.dma1_box, 0, 2)
        self.dma2_box = ConfigSpinWidget(self, "DMA 2")
        self.grid.addWidget(self.dma2_box, 1, 2)

    def get_config_options(self):
        opts = {}
        opts["gusbase"] = self.base_box.get_config_option()
        opts["irq1"] = self.irq1_box.get_config_option()
        opts["irq2"] = self.irq2_box.get_config_option()
        opts["dma1"] = self.dma1_box.get_config_option()
        opts["dma2"] = self.dma2_box.get_config_option()

        return opts

    def set_config_options(self, opts):
        self.base_box.set_config_option(opts["gusbase"])
        self.irq1_box.set_config_option(opts["irq1"])
        self.irq2_box.set_config_option(opts["irq2"])
        self.dma1_box.set_config_option(opts["dma1"])
        self.dma2_box.set_config_option(opts["dma2"])
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:37,代码来源:sndcfg.py

示例2: BaseWorksEntryFrame

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseWorksEntryFrame(QFrame):
    def __init__(self, parent, name='BaseWorksEntryFrame'):
        QFrame.__init__(self, parent, name)
        margin = 0
        space = 1
        self.grid = QGridLayout(self, 6, 1, margin, space)
        
        self.worktype_lbl = QLabel('Work Type', self)
        self.worktype_entry = KLineEdit('website', self)
        self.title_lbl = QLabel('Title', self)
        self.title_entry = KLineEdit('', self)
        self.url_lbl = QLabel('Url', self)
        self.url_entry = KLineEdit('', self)

        row = 0
        for widget in [self.worktype_lbl, self.worktype_entry,
                       self.title_lbl, self.title_entry,
                       self.url_lbl, self.url_entry]:
            self.grid.addWidget(widget, row, 0)
            row += 1
            
    def get_data(self):
        wtype = str(self.worktype_entry.text())
        title = str(self.title_entry.text())
        url = str(self.url_entry.text())
        return dict(title=title, url=url, type=wtype)

    def set_data(self, data):
        self.title_entry.setText(data['title'])
        self.url_entry.setText(data['url'])
        wtype = data['type']
        if wtype is None:
            wtype = 'website'
        self.worktype_entry.setText(wtype)
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:36,代码来源:utdialogs.py

示例3: IntroPage

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class IntroPage(BaseConfigWidget):
    def __init__(self, parent, name='IntroPage'):
        BaseConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 1
        margin = 5
        space = 7
        self.grid = QGridLayout(self, numrows, numcols,
                                margin, space, 'IntroPageLayout')
        lbl = QLabel(intro, self)
        self.grid.addWidget(lbl, 0, 0)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:13,代码来源:wizard.py

示例4: SoundBlasterHardwareOptions

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class SoundBlasterHardwareOptions(QWidget):
    def __init__(self, parent, name="SoundBlasterHardwareOptions"):
        QWidget.__init__(self, parent, name)
        numrows = 2
        numcols = 3
        margin = 0
        space = 1
        self.grid = QGridLayout(self, numrows, numcols, margin, space, "SoundBlasterHardwareOptionsLayout")
        self.base_box = ConfigSpinWidget(self, "I/O address", max=1000)
        self.grid.addWidget(self.base_box, 0, 0)
        self.irq_box = ConfigSpinWidget(self, "IRQ", min=3, max=15)
        self.grid.addWidget(self.irq_box, 1, 0)
        self.dma_box = ConfigSpinWidget(self, "DMA")
        self.grid.addWidget(self.dma_box, 0, 2)
        self.hdma_box = ConfigSpinWidget(self, "High DMA")
        self.grid.addWidget(self.hdma_box, 1, 2)

    def get_config_options(self):
        opts = {}
        opts["sbbase"] = self.base_box.get_config_option()
        opts["irq"] = self.irq_box.get_config_option()
        opts["dma"] = self.dma_box.get_config_option()
        opts["hdma"] = self.hdma_box.get_config_option()
        return opts

    def set_config_options(self, opts):
        self.base_box.set_config_option(opts["sbbase"])
        self.irq_box.set_config_option(opts["irq"])
        self.dma_box.set_config_option(opts["dma"])
        self.hdma_box.set_config_option(opts["hdma"])
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:32,代码来源:sndcfg.py

示例5: TestConfigTab

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class TestConfigTab(QWidget):
    def __init__(self, parent, name='TestConfigTab'):
        QWidget.__init__(self, parent, name)
        self.grid = QGridLayout(self, 2, 1, 0, 1, 'TestConfigTabLayout')
        self.textbrowser = KTextBrowser(self)
        self.grid.addWidget(self.textbrowser, 0, 0)
        self.button = KPushButton(self)
        self.button.setText('test get_config')
        self.grid.addWidget(self.button, 1, 0)
        
    def set_config(self, cfg):
        tfile = StringIO()
        cfg.write(tfile)
        tfile.seek(0)
        text = tfile.read()
        self.textbrowser.setText(text)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:18,代码来源:cfgmain.py

示例6: DosboxPathPage

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class DosboxPathPage(BaseConfigWidget):
    def __init__(self, parent, name='DosboxPathPage'):
        BaseConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 1
        margin = 5
        space = 7
        self.grid = QGridLayout(self, numrows, numcols,
                                margin, space, 'DosboxPathPageLayout')
        lbl = QLabel(dosbox_path_lbl, self)
        lbl.setFrameStyle(lbl.Panel + lbl.Sunken)
        #lbl.setFrameStyle(lbl.Raised)
        self.grid.addWidget(lbl, 0, 0)
        self.dosbox_path_entry = ConfigKURLSelectWidget(self, 'Path to main dosbox area',
                                                        filetype='dir')
        self.grid.addWidget(self.dosbox_path_entry, 1, 0)
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:18,代码来源:wizard.py

示例7: LabeledProgress

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class LabeledProgress(QWidget):
    def __init__(self, parent, text='', name='LabeledProgress'):
        QWidget.__init__(self, parent, name)
        self.grid = QGridLayout(self, 2, 1, 5, 7)
        self.label = QLabel(self)
        if text:
            self.label.setText(text)
        self.progressbar = SimpleProgress(self)
        self.grid.addWidget(self.label, 0, 0)
        self.grid.addWidget(self.progressbar, 1, 0)
                  
    def setTotalSteps(self, total):
        self.progressbar.setTotalSteps(total)

    def step_progress(self, *args):
        self.progressbar.step_progress(*args)
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:18,代码来源:progress.py

示例8: onDockChartViewToggled

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
 def onDockChartViewToggled(self, checked):
   if checked:
     self.chartPopupWindow = QDialog()
     self.chartPopupWindow.setWindowFlags(PythonQt.QtCore.Qt.WindowStaysOnTopHint)
     layout = QGridLayout()
     self.chartPopupWindow.setLayout(layout)
     layout.addWidget(self._multiVolumeIntensityChart.chartView)
     layout.addWidget(self.popupChartButton)
     self.chartPopupWindow.finished.connect(self.dockChartView)
     self.chartPopupWindow.resize(self.chartPopupSize)
     self.chartPopupWindow.move(self.chartPopupPosition)
     self.chartPopupWindow.show()
     self.popupChartButton.setText("Dock chart")
     self._multiVolumeIntensityChart.chartView.show()
   else:
     self.chartPopupWindow.close()
开发者ID:naucoin,项目名称:MultiVolumeExplorer,代码行数:18,代码来源:qSlicerMultiVolumeExplorerModuleWidget.py

示例9: ImportGameDialog

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class ImportGameDialog(BaseDialogWindow):
    def __init__(self, parent, name='ImportGameDialog'):
        BaseDialogWindow.__init__(self, parent, name=name)
        self.frame = QFrame(self)
        margin = 5
        space = 7
        self.grid = QGridLayout(self.frame, 2, 1, margin, space)
        self.url_lbl = QLabel('URL', self.frame)
        self.url_entry = KLineEdit('', self.frame)
        self.grid.addWidget(self.url_lbl, 0, 0)
        self.grid.addWidget(self.url_entry, 1, 0)
        self.setMainWidget(self.frame)
        self.connect(self, SIGNAL('okClicked()'), self.import_game)
        

    def import_game(self):
        url = str(self.url_entry.text())
        print url
        KMessageBox.information(self, "import_game is still not implemented")
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:21,代码来源:gamedata_widgets.py

示例10: BaseGuestAppearanceFrame

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseGuestAppearanceFrame(QFrame):
    def __init__(self, parent, name='BaseGuestAppearanceFrame'):
        QFrame.__init__(self, parent, name)
        margin = 0
        space = 1
        self.grid = QGridLayout(self, 4, 1, margin, space)
        self.appearance_lbl = QLabel('Appearance', self)
        self.appearance_url = KLineEdit('', self)
        row = 0
        for widget in [self.appearance_lbl, self.appearance_url]:
            self.grid.addWidget(widget, row, 0)
            row += 1

    def get_data(self):
        url = str(self.appearance_url.text())
        return dict(url=url)

    def set_data(self, data):
        self.appearance_url.setText(data['url'])
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:21,代码来源:utdialogs.py

示例11: BaseTagDialogFrame

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseTagDialogFrame(QFrame):
    def __init__(self, parent, name='BaseEntityDataFrame'):
        QFrame.__init__(self, parent, name)
        self.entityid = None
        numrows = 5
        numcols = 1
        margin = 0
        space = 1
        self.grid = QGridLayout(self, numrows, numcols,
                                margin, space, 'BaseEntityDataLayout')
        self.app = get_application_pointer()

        self.lbl = QLabel('Select the tags', self)
        self.grid.addWidget(self.lbl, 0, 0)

        self.listView = KListView(self)
        self.listView.addColumn('tagname', -1)
        self.listView.clear()
        self.grid.addMultiCellWidget(self.listView, 1, 4, 0, 0)
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:21,代码来源:dialogs.py

示例12: ImportGameUrlDialog

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class ImportGameUrlDialog(BaseDialogWindow):
    def __init__(self, parent, name='ImportGameUrlDialog'):
        BaseDialogWindow.__init__(self, parent, name=name)
        self.frame = QFrame(self)
        margin = 5
        space = 7
        self.grid = QGridLayout(self.frame, 2, 1, margin, space)
        self.url_lbl = QLabel('URL', self.frame)
        self.url_entry = KLineEdit('', self.frame)
        self.grid.addWidget(self.url_lbl, 0, 0)
        self.grid.addWidget(self.url_entry, 1, 0)
        self.setMainWidget(self.frame)
        self.connect(self, SIGNAL('okClicked()'), self.import_game)
        self.handler = AbandonGamesHandler(self.app)

    def _makeinfo(self, base, parser):
        text = 'Title: %s\n' % parser.title
        if parser.smallinfo:
            text += 'Small Information'
            for k,v in parser.smallinfo.items():
                text += '%s: %s\n' % ( k.capitalize(), v)
        #text += str(parser.smallinfo) + '\n'
        dlurl = base + parser.download_link
        text += 'download page: %s\n' % dlurl
        text += 'direct link: %s\n' % parser.real_download_link
        if parser.files:
            text += 'Files:\n'
            text += '======\n'
            for f in parser.files:
                text += '%s%s\n' % (base, f)
        return text
        
    def import_game(self):
        url = str(self.url_entry.text())
        print url
        #KMessageBox.information(self, "import_game is still not implemented")
        
        #self.handler.get_game_data(url)
        self.handler.handle_url(url)
        #self.handler.parser.feed(file('dunetest.html').read())
        win = AbandoniaInfoWindow(self)
        win.show()
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:44,代码来源:importgame.py

示例13: BaseConfigOptionWidget

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseConfigOptionWidget(BaseConfigWidget):
    def __init__(self, parent, labeltext, optclass,
                 name='BaseConfigOptionWidget'):
        BaseConfigWidget.__init__(self, parent, name=name)
        numrows = 2
        numcols = 2
        margin = 0
        space = 1
        self.grid = QGridLayout(self, numrows, numcols,
                                margin, space, 'BaseConfigOptionWidgetLayout')
        self.label = QLabel(labeltext, self)
        self.grid.addWidget(self.label, 0, 0)
        self.mainwidget = optclass(self)
        self.grid.addWidget(self.mainwidget, 1, 0)

    def get_config_option(self):
        raise NotImplementedError, 'get_config_option needs to be defined in subclass'

    def set_config_option(self, option):
        raise NotImplementedError, 'set_config_option needs to be defined in subclass'
开发者ID:BackupTheBerlios,项目名称:dosbox-pykde-svn,代码行数:22,代码来源:config.py

示例14: BaseGuestPictureFrame

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseGuestPictureFrame(QFrame):
    def __init__(self, parent, name='BaseGuestPictureFrame'):
        QFrame.__init__(self, parent, name)
        margin = 0
        space = 1
        self.grid = QGridLayout(self, 2, 2, margin, space)
        self.picture_lbl = QLabel('Picture', self)
        self.picture_url = KLineEdit('', self)
        self.picture_btn = KPushButton(KStdGuiItem.Open(),
                                       'Browse for picture', self)

        self.grid.addMultiCellWidget(self.picture_lbl, 0, 0, 0, 1)
        self.grid.addWidget(self.picture_url, 0, 1)
        self.grid.addWidget(self.picture_btn, 1, 1)
        
    def get_data(self):
        url = str(self.appearance_url.text())
        return dict(url=url)

    def set_data(self, data):
        self.appearance_url.setText(data['url'])
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:23,代码来源:utdialogs.py

示例15: BaseGuestWorksFrame

# 需要导入模块: from qt import QGridLayout [as 别名]
# 或者: from qt.QGridLayout import addWidget [as 别名]
class BaseGuestWorksFrame(QFrame):
    def __init__(self, parent, name='BaseGuestWorksFrame'):
        QFrame.__init__(self, parent, name)
        self.works_entries = []
        margin = 0
        space = 1
        self.grid = QGridLayout(self, 2, 6, margin, space)
        self.works_lbl = QLabel('Works', self)
        self.grid.addMultiCellWidget(self.works_lbl, 0, 0, 0, 4)
        self.add_works_btn = KPushButton('+', self, 'add_works_button')
        self.add_works_btn.connect(self.add_works_btn,
                                   SIGNAL('clicked()'),
                                   self.add_works_entries)
        self.grid.addWidget(self.add_works_btn, 0, 5)
        
    def add_works_entries(self):
        frame = BaseWorksEntryFrame(self)
        row = len(self.works_entries) + 1
        self.grid.addMultiCellWidget(frame, row, row, 0, -1)
        self.works_entries.append(frame)
        frame.show()
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:23,代码来源:utdialogs.py


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