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


Python KListView.setRootIsDecorated方法代码示例

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


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

示例1: PaellaRecordSelector

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class PaellaRecordSelector(QSplitter, BasePaellaWidget):
    def __init__(self, parent, table, fields, idcol, groupfields,
                 mainview, name='PaellaRecordSelector'):
        #PaellaManagerWidget.__init__(self, parent, mainview, name=name)
        QSplitter.__init__(self, parent, name)
        BasePaellaWidget.initPaellaCommon(self)
        self.current = currentobject()
        self.table = table
        self.fields = fields
        self.idcol = idcol
        self.groupfields = groupfields
        self.listView = KListView(self)
        self.vsplit = QSplitter(self)
        self.vsplit.setOrientation(self.Vertical)
        self.mainView = mainview(self.vsplit)
        self.recordForm = EditableRecordFrame(self, fields)
        self.connect(self.listView, SIGNAL('selectionChanged()'),
                     self.groupChanged)
        self.connect(self.recordForm.insButton, SIGNAL('clicked()'),
                     self.insertRecord)
        self.connect(self.recordForm.updButton, SIGNAL('clicked()'),
                     self.updateRecord)
        self.initlistView()
        self.setSource(self.handleURL)
        
    def initlistView(self):
        self.listView.addColumn('group')
        self.listView.setRootIsDecorated(True)
开发者ID:joelsefus,项目名称:paella,代码行数:30,代码来源:widgets.py

示例2: SimpleSplitWindow

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class SimpleSplitWindow(KMainWindow):
    def __init__(self, app, parent, view, name):
        KMainWindow.__init__(self, parent, name)
        self.app = app
        self.conn = app.conn
        self.mainView = QSplitter(self, 'mainView')
        self.listView = KListView(self.mainView)
        self.listView.setRootIsDecorated(True)
        self.view = view(self.app, self.mainView)
        self.setCentralWidget(self.mainView)
        if hasattr(self, 'initlistView'):
            self.initlistView()
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'), self.selectionChanged)
        self.show()
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:17,代码来源:gui.py

示例3: ClientsMainWindow

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class ClientsMainWindow(BasePaellaWindow):
    def __init__(self, parent):
        BasePaellaWindow.__init__(self, parent, name='ClientsMainWindow')
        self.initPaellaCommon()
        self.initActions()
        self.initMenus()
        self.initToolbar()
        self.cursor = self.conn.cursor(statement=True)
        self.listView = KListView(self)
        self.setCentralWidget(self.listView)
        self.refreshListView()
        self.resize(600, 800)
        self.setCaption('Paella Profiles')

    def initActions(self):
        collection = self.actionCollection()
        self.quitAction = KStdAction.quit(self.close, collection)
        self.newClientAction = KStdAction.openNew(self.slotNewClient, collection)

    def initMenus(self):
        mainmenu = KPopupMenu(self)
        menubar = self.menuBar()
        menubar.insertItem('&Main', mainmenu)
        menubar.insertItem('&Help', self.helpMenu(''))
        self.newClientAction.plug(mainmenu)
        self.quitAction.plug(mainmenu)

    def initToolbar(self):
        toolbar = self.toolBar()
        self.newClientAction.plug(toolbar)
        self.quitAction.plug(toolbar)

    def initlistView(self):
        self.listView.setRootIsDecorated(False)
        self.listView.addColumn('profile')

    def refreshListView(self):
        self.listView.clear()
        for row in self.profile.select(fields=['profile', 'suite'], order=['profile']):
            item = KListViewItem(self.listView, row.profile)
            item.profile = row.profile

    def slotNewClient(self):
        KMessageBox.information(self, 'New Client not ready yet.')

    def selectionChanged(self):
        item = self.listView.currentItem()
        self.mainView.set_profile(item.profile)
开发者ID:joelsefus,项目名称:paella,代码行数:50,代码来源:clients.py

示例4: RecordSelector

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class RecordSelector(QSplitter):
    def __init__(self, parent, db, table, fields, idcol, groupfields, view, name='RecordSelector'):
        QSplitter.__init__(self, parent, name)
        self.current = currentobject()
        self.db = db
        self.table = table
        self.fields = fields
        self.idcol = idcol
        self.groupfields = groupfields
        self.listView = KListView(self)
        self.vsplit = QSplitter(self)
        self.vsplit.setOrientation(Qt.Vertical)
        self.recView = view(db, self.vsplit)
        frame = QFrame(self.vsplit)
        self.recForm = EditableRecord(frame, fields)
        self.connect(self.listView, SIGNAL('selectionChanged()'), self.groupChanged)
        self.connect(self.recForm.insButton, SIGNAL('clicked()'), self.insertRecord)
        self.connect(self.recForm.updButton, SIGNAL('clicked()'), self.updateRecord)
        self.initlistView()
        self.setSource(self.handleURL)
    
    def initlistView(self):
        self.listView.addColumn('group')
        self.listView.setRootIsDecorated(True)
        all = KListViewItem(self.listView, 'all')
        groups = [KListViewItem(self.listView, g) for g in self.groupfields]
        for g, parent in zip(self.groupfields, groups):
            fields = ['distinct %s' % g]
            rows = self.db.mcursor.select(fields=fields, table=self.table, order=g)
            for row in rows:
                item = KListViewItem(parent, row[g])
                item.groupfield = g
                

    def groupChanged(self):
        item = self.listView.currentItem()
        self.current.group = item.text(0)
        if hasattr(item, 'groupfield'):
            clause = Eq(item.groupfield, self.current.group)
            self.recView.set_clause(clause)
        elif self.current.group == 'all':
            self.recView.set_clause(None)
        else:
            self.recView.set_clause('NULL')

    def handleURL(self, url):
        action, obj, ident = str(url).split('.')
        row = self.db.mcursor.select_row(fields=self.fields,
                                         table=self.table, clause=Eq(self.idcol, ident))
        entries = self.recForm.entries
        for field in entries:
            entries[field].setText(row[field])
        self.current.id = ident
        

    def setSource(self, handler):
        self.recView.setSource = handler

    def insertRecord(self):
        data = self.recForm.get_data()
        self.db.insertData(self.idcol, self.table, data)
        self.groupChanged()

    def updateRecord(self):
        if self.current.id is not None:
            data = self.recForm.get_data()
            clause = Eq(self.idcol, self.current.id)
            row = self.db.mcursor.select_row(table=self.table, clause=clause)
            updict = {}
            for k, v in data.items():
                if str(row[k]) != str(v) and str(v):
                    print v
                    updict[k] = v
            print updict
        if updict:
            self.db.mcursor.update(table=self.table, data=updict, clause=clause)
            self.groupChanged()
开发者ID:BackupTheBerlios,项目名称:konsultant-svn,代码行数:79,代码来源:gui.py

示例5: PaellaMainWindowSmall

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class PaellaMainWindowSmall(BasePaellaMainWindow):
    def __init__(self, parent=None, name='PaellaMainWindowSmall'):
        print 'using window', name
        BasePaellaMainWindow.__init__(self, parent, name)
        # In this window, we use a listbox to select the other
        # parts of the application
        self.listView = KListView(self)
        self.listView.setRootIsDecorated(True)
        self.listView.addColumn('widget')
        self.setCentralWidget(self.listView)
        if self.app.conn is not None:
            self.refreshListView()
        self.setCaption('Main Menu')
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'),
                     self.selectionChanged)

    def _import_export_directory_selected(self):
        BasePaellaMainWindow._import_export_directory_selected(self)
        self.refreshListView()
        
    def refreshListView(self):
        self.listView.clear()
        self._refresh_suites()
        suite_folder = KListViewItem(self.listView, 'suites')
        suite_folder.folder = True
        for suite in self._suites:
            item = KListViewItem(suite_folder, suite)
            item.suite = suite
        profile_folder = KListViewItem(self.listView, 'profiles')
        profile_folder.profiles = True
        family_folder = KListViewItem(self.listView, 'families')
        family_folder.families = True
        machine_folder = KListViewItem(self.listView, 'machines')
        machine_folder.machines = True
        differ_folder = KListViewItem(self.listView, 'differs')
        differ_folder.differs = True
        differ_folder.folder = True
        for dtype in ['trait', 'family']:
            item = KListViewItem(differ_folder, dtype)
            item.dtype = dtype
        environ_folder = KListViewItem(self.listView, 'environ')
        environ_folder.environ = True
        environ_folder.folder = True
        for etype in ['default', 'current']:
            item = KListViewItem(environ_folder, etype)
            item.etype = etype
        # installer widget is still unimplemented
        if False:
            installer_folder = KListViewItem(self.listView, 'installer')
            installer_folder.installer = True
        if self.app.cfg.getboolean('management_gui', 'client_widget'):
            clients_folder = KListViewItem(self.listView, 'clients')
            clients_folder.clients = True
        
    def selectionChanged(self):
        current = self.listView.currentItem()
        win = None
        if hasattr(current, 'suite'):
            print 'suite is', current.suite
            if  not self._suites:
                KMessageBox.information(self, "No suites are present.")
            else:
                win = TraitMainWindow(self, current.suite)
        elif hasattr(current, 'profiles'):
            win = ProfileMainWindow(self)
        elif hasattr(current, 'families'):
            self.slotManageFamilies()
        elif hasattr(current, 'machines'):
            win = MachineMainWindow(self)
        elif hasattr(current, 'dtype'):
            print 'differ', current.dtype
            win = DifferWindow(self, current.dtype)
        elif hasattr(current, 'etype'):
            win = EnvironmentWindow(self, current.etype)
        elif hasattr(current, 'installer'):
            #win = InstallerMainWin(self)
            KMessageBox.information(self, 'Not Implemented')
        elif hasattr(current, 'clients'):
            win = ClientsMainWindow(self)
        elif hasattr(current, 'folder'):
            # nothing important selected, do nothing
            pass
        else:
            KMessageBox.error(self, 'something bad happened in the list selection')
        if win is not None:
            win.show()
            self._all_my_children.append(win)
            
    def slotManageFamilies(self):
        print 'running families'
        #FamilyMainWindow(self.app, self)
        #KMessageBox.error(self, 'Managing families unimplemented')
        win = FamilyMainWindow(self)
        win.show()
        self._all_my_children.append(win)
        
    def slotManageSuite(self, wid=-1):
        print 'in slotManageSuite suite is', wid
        #TraitMainWindow(self.app, self, current.suite)
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:103,代码来源:main.py

示例6: MachineMainWindow

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [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

示例7: PaellaMainWindow

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class PaellaMainWindow(KMainWindow):
    def __init__(self, app, *args):
        KMainWindow.__init__(self, *args)
        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.listView = KListView(self)
        self.listView.setRootIsDecorated(True)
        self.listView.addColumn('widget')
        self.setCentralWidget(self.listView)
        self.refreshListView()
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'), self.selectionChanged)

    def initActions(self):
        collection = self.actionCollection()
        self.manageFamiliesAction = ManageFamilies(self.slotManageFamilies, collection)
        self.editTemplatesAction = EditTemplateAction(self.slotEditTemplates, collection)
        self.quitAction = KStdAction.quit(self.app.quit, collection)
       
    def initMenus(self):
        mainMenu = KPopupMenu(self)
        actions = [self.manageFamiliesAction,
                   self.editTemplatesAction,
                   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.manageFamiliesAction,
                   self.editTemplatesAction,
                   self.quitAction]
        for action in actions:
            action.plug(toolbar)
            
    def refreshListView(self):
        suite_folder = KListViewItem(self.listView, 'suites')
        for row in self.cursor.select(table='suites'):
            item = KListViewItem(suite_folder, row.suite)
            item.suite = row.suite
        profile_folder = KListViewItem(self.listView, 'profiles')
        profile_folder.profiles = True
        family_folder = KListViewItem(self.listView, 'families')
        family_folder.families = True
        machine_folder = KListViewItem(self.listView, 'machines')
        machine_folder.machines = True
        differ_folder = KListViewItem(self.listView, 'differs')
        differ_folder.differs = True
        for dtype in ['trait', 'family']:
            item = KListViewItem(differ_folder, dtype)
            item.dtype = dtype
        environ_folder = KListViewItem(self.listView, 'environ')
        environ_folder.environ = True
        for etype in ['default', 'current']:
            item = KListViewItem(environ_folder, etype)
            item.etype = etype
            
    def selectionChanged(self):
        current = self.listView.currentItem()
        if hasattr(current, 'suite'):
            print 'suite is', current.suite
            TraitMainWindow(self.app, self, current.suite)
        elif hasattr(current, 'profiles'):
            ProfileMainWindow(self.app, self)
        elif hasattr(current, 'families'):
            self.slotManageFamilies()
        elif hasattr(current, 'machines'):
            MachineMainWindow(self.app, self)
        elif hasattr(current, 'dtype'):
            print 'differ', current.dtype
            DifferWin(self.app, self, current.dtype)
        elif hasattr(current, 'etype'):
            DefEnvWin(self.app, self, current.etype)
            
    def slotManageFamilies(self):
        print 'running families'
        FamilyMainWindow(self.app, self)
            
    def slotEditTemplates(self):
        print 'edit templates'
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:90,代码来源:main.py

示例8: AdminWidget

# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import setRootIsDecorated [as 别名]
class AdminWidget(KMainWindow):
    def __init__(self, app, parent):
        KMainWindow.__init__(self, parent, 'AdminWidget')
        self.app = app
        self.db = app.db
        self.manager = AdminDb(self.app)
        self.mainView = QSplitter(self, 'main view')
        self.listView = KListView(self.mainView)
        self.groupView = KListView(self.mainView)
        self.setCentralWidget(self.mainView)
        self.initActions()
        self.initMenus()
        self.initToolbar()
        self.initlistView()
        self.connect(self.listView,
                     SIGNAL('selectionChanged()'), self.selectionChanged)
        self.dialogs = {}
        self.show()

    def initActions(self):
        collection = self.actionCollection()
        self.quitAction = KStdAction.quit(self.close, collection)
        self.adduserAction = AddDbUser(self.slotAddDbUser, collection)
        self.addgroupAction = AddDbGroup(self.slotAddDbGroup, collection)
        self.addschemaAction = AddDbSchema(self.slotAddDbSchema, collection)
        
    def initMenus(self):
        mainmenu = KPopupMenu(self)
        actions = [self.adduserAction, self.addgroupAction,
                   self.addschemaAction, self.quitAction]
        for action in actions:
            action.plug(mainmenu)
        self.menuBar().insertItem('&Main', mainmenu)
        self.menuBar().insertItem('&Help', self.helpMenu(''))
        
    def initToolbar(self):
        toolbar = self.toolBar()
        actions = [self.adduserAction, self.addgroupAction,
                   self.addschemaAction, self.quitAction]
        for action in actions:
            action.plug(toolbar)

    def initlistView(self):
        self.listView.addColumn('grouping')
        self.listView.setRootIsDecorated(True)
        self.groupView.addColumn('user')
        self.groupView.setRootIsDecorated(True)
        self.refreshlistView()
        
    def refreshlistView(self):
        self.listView.clear()
        rows = self.manager.get_users()
        print rows
        print 'helo;'
        users = KListViewItem(self.listView, 'user')
        groups = KListViewItem(self.listView, 'group')
        for row in rows:
            c = KListViewItem(users, row.usename)
            c.userid = row.usesysid
        for row in self.manager.get_groups():
            c = KListViewItem(groups, row.group)
            c.grosysid = row.grosysid

    def refreshGroupView(self):
        pass
    
    def selectionChanged(self):
        current = self.listView.currentItem()
        print current
        if hasattr(current, 'userid'):
            print 'user is', current.userid, current.text(0)
        elif hasattr(current, 'grosysid'):
            group = str(current.text(0))
            rows = self.manager.get_users(group=group)
            self.groupView.clear()
            for row in rows:
                c = KListViewItem(self.groupView, row.usename)
                
        
    def slotAddDbGroup(self):
        dlg = AddGroupDialog(self)
        dlg.connect(dlg, SIGNAL('okClicked()'), self.addDbGroupok)
        self.dialogs['new-group'] = dlg
        

    def slotAddDbUser(self):
        dlg = AddUserDialog(self)
        dlg.connect(dlg, SIGNAL('okClicked()'), self.addDbUserok)
        self.dialogs['new-user'] = dlg

    def slotAddDbSchema(self):
        dlg = SimpleRecordDialog(self, ['schema'], 'AddDbSchemaDialog')
        dlg.connect(dlg, SIGNAL('okClicked()'), self.addDbSchemaok)
        self.dialogs['new-schema'] = dlg
        
    def addDbUserok(self):
        dlg = self.dialogs['new-user']
        usename = str(dlg.grid.entries['username'].text())
        self.manager.create_user(usename)
        self.db.conn.commit()
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:103,代码来源:admin.py


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