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


Python KListView.show方法代码示例

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


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

示例1: MachineMainWindow

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import show [as 别名]
class MachineMainWindow(KMainWindow):
    def __init__(self, app, parent):
        KMainWindow.__init__(self, parent)
        self.app = app
        self.icons = KIconLoader()
        self.initActions()
        self.initMenus()
        self.initToolbar()
        self.conn = app.conn
        self.cfg = app.cfg
        self.cursor = StatementCursor(self.conn)
        self.mainView = None
        self.resize(400, 300)
        self.show()

    def _killmainView(self):
        if self.mainView is not None:
            print 'need to kill mainView here'
            del self.mainView
            self.mainView = None
            
    def initActions(self):
        collection = self.actionCollection()
        self.quitAction = KStdAction.quit(self.app.quit, collection)
        self._manage_actions = {}
        for k,v in ManageActions.items():
            att = 'slotManage%s' % k
            self._manage_actions[k] = v(getattr(self, att), collection)
            
    def initMenus(self):
        mainMenu = KPopupMenu(self)
        actions = self._manage_actions.values()
        actions += [self.quitAction]
        self.menuBar().insertItem('&Main', mainMenu)
        self.menuBar().insertItem('&Help', self.helpMenu(''))
        for action in actions:
            action.plug(mainMenu)
            
    def initToolbar(self):
        toolbar = self.toolBar()
        actions = self._manage_actions.values()
        actions += [self.quitAction]
        for action in actions:
            action.plug(toolbar)
            
    def refreshListView(self):
        machine_folder = KListViewItem(self.listView, 'machines')
                    
    def selectionChanged(self):
        current = self.listView.currentItem()
        print current, dir(current)
            
    def slotManagemachine(self):
        self._killmainView()
        self._managing = 'machines'
        table='machines'
        rows = self.cursor.select(table='machines')
        columns = ['machine', 'machine_type', 'kernel', 'profile', 'filesystem']
        self.mainView = MachineManager(self.app, self)
        self.setCentralWidget(self.mainView)
        self.connect(self.mainView.listView,
                     SIGNAL('rightButtonClicked(QListViewItem *, const QPoint &, int )'),
                     self.slotMouseIsPressed)
        self.mainView.show()
        print 'manage machines'
        print '%d machines' % len(rows)

    def slotManagemachine_type(self):
        self._killmainView()
        self._managing = 'machine_types'
        self.mainView = MachineTypeManager(self.app, self)
        self.setCentralWidget(self.mainView)
        self.connect(self.mainView.listView,
                     SIGNAL('rightButtonClicked(QListViewItem *, const QPoint &, int )'),
                     self.slotMouseIsPressed)
        self.mainView.show()
        print 'manage machine_types'

    def slotManagefilesystem(self):
        self._killmainView()
        self._managing = 'filesystems'
        self.mainView = FilesystemManager(self.app, self)
        self.setCentralWidget(self.mainView)
        self.mainView.show()
        print 'manage filesystems'

    def slotManagekernels(self):
        self._killmainView()
        self._managing = 'kernels'
        table = 'kernels'
        rows = self.cursor.select(table='kernels')
        self.mainView = KListView(self)
        self.mainView.setRootIsDecorated(True)
        self.setCentralWidget(self.mainView)
        self.mainView.addColumn('kernel')
        self.connect(self.mainView,
                     SIGNAL('rightButtonClicked(QListViewItem *, const QPoint &, int )'),
                     self.slotMouseIsPressed)
        for row in rows:
            KListViewItem(self.mainView, row.kernel)
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:103,代码来源:machine.py


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