本文整理汇总了Python中kdeui.KListView.clear方法的典型用法代码示例。如果您正苦于以下问题:Python KListView.clear方法的具体用法?Python KListView.clear怎么用?Python KListView.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kdeui.KListView
的用法示例。
在下文中一共展示了KListView.clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImportsMainWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class ImportsMainWindow(BaseMainWindow):
def __init__(self, parent, name='ImportsMainWindow'):
BaseMainWindow.__init__(self, parent, name=name)
self.handler = AbandonGamesHandler(self.app)
self.splitView = QSplitter(self)
self.listView = KListView(self.splitView)
self.connect(self.listView,
SIGNAL('selectionChanged()'), self.selectionChanged)
self.initlistView()
self.textView = MainAbandoniaPart(self.splitView)
self.setCentralWidget(self.splitView)
def initlistView(self):
self.listView.addColumn('games', -1)
self.refreshListView()
def refreshListView(self):
self.listView.clear()
gameids = self.handler.get_all_html_ids()
print 'in initlistView', gameids
for gameid in gameids:
#item = KListViewItem(self.listView, str(gameid))
#item.gameid = gameid
self.handler.get_game_data(gameid)
item = KListViewItem(self.listView, self.handler.parser.title)
item.gameid = gameid
def selectionChanged(self):
item = self.listView.currentItem()
self.handler.get_game_data(item.gameid)
print 'in selectionChanged', self.handler.parser.gameid
self.textView.set_game_info(self.handler)
示例2: ClientsMainWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [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)
示例3: SuiteSelector
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class SuiteSelector(KDialogBase):
def __init__(self, app, parent):
KDialogBase.__init__(self, parent, 'SuiteSelector')
dbwidget(self, app)
self.suites = Suites(self.conn)
self.listView = KListView(self)
self.listView.addColumn('suite')
self.setMainWidget(self.listView)
self.refreshlistView()
self.show()
def refreshlistView(self):
self.listView.clear()
for suite in self.suites.list():
item = KListViewItem(self.listView, suite)
item.suite = suite
示例4: BaseTagDialogFrame
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [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)
示例5: MainWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class MainWindow(KMainWindow):
def __init__(self, parent):
KMainWindow.__init__(self, parent, 'Uncover Truth Frontend')
self.app = get_application_pointer()
self.splitView = QSplitter(self, 'splitView')
self.listView = KListView(self.splitView, 'guests_view')
self.textView = InfoPart(self.splitView)
self.initlistView()
self.connect(self.listView,
SIGNAL('selectionChanged()'), self.selectionChanged)
self.connect(self.textView,
PYSIGNAL('GuestInfoUpdated'), self.refreshDisplay)
self.setCentralWidget(self.splitView)
collection = self.actionCollection()
self.quitAction = KStdAction.quit(self.close, collection)
self.newGuestAction = KStdAction.openNew(self.slotNewGuest, collection)
self.selectAllAction = KStdAction.selectAll(self.slotSelectAll,
collection)
mainmenu = KPopupMenu(self)
self.newGuestAction.plug(mainmenu)
self.selectAllAction.plug(mainmenu)
self.quitAction.plug(mainmenu)
menubar = self.menuBar()
menubar.insertItem('&Main', mainmenu)
toolbar = self.toolBar()
self.newGuestAction.plug(toolbar)
self.quitAction.plug(toolbar)
self.new_guest_dialog = None
# resize window
self.resize(400, 500)
self.splitView.setSizes([75, 325])
def initlistView(self):
self.listView.addColumn('guests', -1)
self.refreshListView()
def refreshListView(self):
self.listView.clear()
cursor = self.app.conn.stmtcursor()
rows = self.app.guests.get_guest_rows()
for row in rows:
name = '%s %s' % (row.firstname, row.lastname)
item = KListViewItem(self.listView, name)
item.guestid = row['guestid']
def slotNewGuest(self):
win = BaseGuestDialog(self)
self.connect(win, SIGNAL('okClicked()'),
self._new_guest_added)
self.new_guest_dialog = win
win.show()
def slotSelectAll(self):
self.textView.view_all_guests()
def _new_guest_added(self):
dlg = self.new_guest_dialog
if dlg is not None:
data = dlg.get_guest_data()
self.app.guests.insert_guest_data(data)
self.refreshListView()
self.new_guest_dialog = None
def selectionChanged(self):
item = self.listView.currentItem()
guestid = item.guestid
self.textView.set_guest_info(item.guestid)
def refreshDisplay(self):
#KMessageBox.error(self, 'ack refreshDisplay called')
#self.refreshListView()
self.selectionChanged()
示例6: MainEntityWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class MainEntityWindow(BaseToolboxWindow):
def __init__(self, parent, name='MainEntityWindow'):
BaseToolboxWindow.__init__(self, parent, name=name)
self.splitView = QSplitter(self, 'splitView')
self.listView = KListView(self.splitView, 'entities_view')
self.textView = InfoPart(self.splitView)
self.initActions()
self.initMenus()
self.initToolbar()
#self._sortby = 'name'
self.initlistView()
self.connect(self.listView,
SIGNAL('selectionChanged()'), self.selectionChanged)
self.connect(self.textView,
PYSIGNAL('EntityInfoUpdated'), self.refreshDisplay)
self.setCentralWidget(self.splitView)
# dialogs
self._new_entity_dlg = None
# resize window
self.resize(400, 500)
self.splitView.setSizes([75, 325])
def initActions(self):
collection = self.actionCollection()
self.quitAction = KStdAction.quit(self.close, collection)
self.newEntityAction = KStdAction.openNew(self.slotNewEntity, collection)
self.newTagAction = NewTagAction(self.slotNewTag, collection)
self.manageEntityTypesAction = KStdAction.addBookmark(self.slotManageEntityTypes,
collection)
def initMenus(self):
mainmenu = KPopupMenu(self)
self.newEntityAction.plug(mainmenu)
self.newTagAction.plug(mainmenu)
self.manageEntityTypesAction.plug(mainmenu)
self.quitAction.plug(mainmenu)
menubar = self.menuBar()
menubar.insertItem('&Main', mainmenu)
def initToolbar(self):
toolbar = self.toolBar()
self.newEntityAction.plug(toolbar)
self.newTagAction.plug(toolbar)
self.manageEntityTypesAction.plug(toolbar)
self.quitAction.plug(toolbar)
def initlistView(self):
self.listView.addColumn('entity', -1)
#self.listView.setSorting(-1)
self.refreshListView()
def refreshListView(self):
self.listView.clear()
#cursor = self.app.conn.stmtcursor()
#rows = self.app.db.get_entities()
#for row in rows:
# item = KListViewItem(self.listView, row['name'])
# item.entityid = row['entityid']
entities = self.app.db.get_entities()
for entity in entities:
item = KListViewItem(self.listView, entity.name)
# we don't need the id anymore
item.entityid = entity.entityid
# since we can hold the whole object
# which will talk to the db as needed
item.entity = entity
def slotNewEntity(self):
from dialogs import SelectEntityTypeDialog
win = SelectEntityTypeDialog(self)
#win = MainEntityDialog(self, dtype='insert')
#self._new_entity_dlg = win
win.show()
def slotNewTag(self):
dlg = NewTagDialog(self)
dlg.show()
def slotManageEntityTypes(self):
win = EntityTypeWindow(self)
win.show()
def _new_entity_added(self):
dlg = self._new_entity_dlg
if dlg is not None:
data = dlg.get_data()
self.app.db.create_entity(data)
self.refreshListView()
self._new_entity_dlg = None
def selectionChanged(self):
item = self.listView.currentItem()
entityid = item.entityid
self.textView.set_info(item.entity)
#.........这里部分代码省略.........
示例7: PaellaMainWindowSmall
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [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)
#.........这里部分代码省略.........
示例8: BaseRtorrentWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class BaseRtorrentWindow(BaseToolboxWindow, MainDropCatcher):
def __init__(self, parent, name='MainEntityWindow'):
BaseToolboxWindow.__init__(self, parent, name=name)
self.splitView = QSplitter(self, 'splitView')
self.listView = KListView(self.splitView, 'entities_view')
self.textView = RtorrentInfoPart(self.splitView)
self.initActions()
self.initMenus()
self.initToolbar()
self.app.rtserver = Server(url="http://roujin/RPC2")
self.app.rtorrent = Rtorrent(self.app.rtserver)
#self._sortby = 'name'
self.initlistView()
self.connect(self.listView,
SIGNAL('selectionChanged()'), self.selectionChanged)
self.connect(self.textView,
PYSIGNAL('EntityInfoUpdated'), self.refreshDisplay)
self.setCentralWidget(self.splitView)
# dialogs
self._new_entity_dlg = None
# resize window
self.resize(400, 500)
self.splitView.setSizes([75, 325])
self.setAcceptDrops(True)
def initActions(self):
collection = self.actionCollection()
self.quitAction = KStdAction.quit(self.close, collection)
self.newEntityAction = KStdAction.openNew(self.slotNewEntity, collection)
self.newTagAction = NewTagAction(self.slotNewTag, collection)
self.manageEntityTypesAction = KStdAction.addBookmark(self.slotManageEntityTypes,
collection)
def initMenus(self):
mainmenu = KPopupMenu(self)
self.newEntityAction.plug(mainmenu)
self.newTagAction.plug(mainmenu)
self.manageEntityTypesAction.plug(mainmenu)
self.quitAction.plug(mainmenu)
menubar = self.menuBar()
menubar.insertItem('&Main', mainmenu)
def initToolbar(self):
toolbar = self.toolBar()
self.newEntityAction.plug(toolbar)
self.newTagAction.plug(toolbar)
self.manageEntityTypesAction.plug(toolbar)
self.quitAction.plug(toolbar)
def initlistView(self):
self.listView.addColumn('entity', -1)
#self.listView.setSorting(-1)
self.refreshListView()
def refreshListView(self):
self.listView.clear()
torrents = self.app.rtorrent.torrents
for k, v in self.app.rtorrent.torrents.items():
item = KListViewItem(self.listView, v.name)
item.infohash = k
def slotNewEntity(self):
from dialogs import SelectEntityTypeDialog
win = SelectEntityTypeDialog(self)
#win = MainEntityDialog(self, dtype='insert')
#self._new_entity_dlg = win
win.show()
def slotNewTag(self):
dlg = NewTagDialog(self)
dlg.show()
def slotManageEntityTypes(self):
win = EntityTypeWindow(self)
win.show()
def _new_entity_added(self):
dlg = self._new_entity_dlg
if dlg is not None:
data = dlg.get_data()
self.app.db.create_entity(data)
self.refreshListView()
self._new_entity_dlg = None
def selectionChanged(self):
item = self.listView.currentItem()
infohash = item.infohash
tv = self.textView
self.textView.set_info(infohash)
def refreshDisplay(self):
#KMessageBox.error(self, 'ack refreshDisplay called')
#.........这里部分代码省略.........
示例9: EntityTypeWindow
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [as 别名]
class EntityTypeWindow(BaseMainWindow):
def __init__(self, parent, name='EntityTypeWindow'):
BaseMainWindow.__init__(self, parent, name=name)
self.splitView = QSplitter(self, 'splitView')
self.etypeView = KListView(self.splitView, 'etypes_view')
self.extfieldsView = KListView(self.splitView, 'extfields_view')
self.initActions()
self.initMenus()
self.initToolbar()
self.setCentralWidget(self.splitView)
self.connect(self.etypeView,
SIGNAL('selectionChanged()'), self.selectionChanged)
self.initlistView()
self.current_etype = None
def initActions(self):
collection = self.actionCollection()
self.quitAction = KStdAction.quit(self.close, collection)
self.newEntityTypeAction = KStdAction.openNew(self.slotNewEntityType, collection)
self.newExtraFieldAction = KStdAction.addBookmark(self.slotNewExtraField, collection)
def initMenus(self):
mainmenu = KPopupMenu(self)
self.newEntityTypeAction.plug(mainmenu)
self.newExtraFieldAction.plug(mainmenu)
self.quitAction.plug(mainmenu)
menubar = self.menuBar()
menubar.insertItem('&Main', mainmenu)
def initToolbar(self):
toolbar = self.toolBar()
self.newEntityTypeAction.plug(toolbar)
self.newExtraFieldAction.plug(toolbar)
self.quitAction.plug(toolbar)
def initlistView(self):
self.etypeView.addColumn('entity type', -1)
self.extfieldsView.addColumn('fieldname')
self.extfieldsView.addColumn('fieldtype')
self.refreshListView()
def refreshListView(self):
self.etypeView.clear()
etypes = self.app.db.get_entity_types()
for etype in etypes:
item = KListViewItem(self.etypeView, etype)
item.etype = etype
def selectionChanged(self):
item = self.etypeView.currentItem()
etype = item.etype
self.current_etype = etype
fields = self.app.db.get_etype_extra_fields(etype)
self.extfieldsView.clear()
for field in fields:
item = KListViewItem(self.extfieldsView, *field)
item.fieldname = field[0]
def slotNewEntityType(self):
dlg = NewEntityTypeDialog(self)
dlg.show()
def slotNewExtraField(self):
if self.current_etype is not None:
dlg = NewExtraFieldDialog(self, self.current_etype)
dlg.show()
示例10: AdminWidget
# 需要导入模块: from kdeui import KListView [as 别名]
# 或者: from kdeui.KListView import clear [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()
#.........这里部分代码省略.........