Example #1
0
 def __init__(self, parent, link):
     QWidget.__init__(self, parent)
     self.setMargin(6)
     self.setSpacing(6)
     
     bar = QToolBar("lala", None, self)
     but = QToolButton(getIconSet("add.png"), i18n("Add"), "lala", parent.slotAdd, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     but = QToolButton(getIconSet("configure.png"), i18n("Edit"), "lala", parent.slotEdit, bar)
     self.edit_but = but
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     but = QToolButton(getIconSet("remove.png"), i18n("Delete"), "lala", self.slotDelete, bar)
     self.delete_but = but
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     lab = QLabel("", bar)
     bar.setStretchableWidget(lab)
     
     toggle = QCheckBox(i18n("Show system user and groups"), bar)
     self.connect(toggle, SIGNAL("toggled(bool)"), self.slotToggle)
     
     tab = QTabWidget(self)
     self.connect(tab, SIGNAL("currentChanged(QWidget*)"), self.slotTabChanged)
     self.tab = tab
     tab.setMargin(6)
     
     self.users = QListView(tab)
     self.users.addColumn(i18n("ID"))
     self.users.setColumnAlignment(0, Qt.AlignRight)
     self.users.addColumn(i18n("User name"))
     self.users.addColumn(i18n("Full name"))
     self.users.setResizeMode(QListView.LastColumn)
     self.users.setAllColumnsShowFocus(True)
     self.connect(self.users, SIGNAL("selectionChanged()"), self.slotSelect)
     self.connect(self.users, SIGNAL("doubleClicked(QListViewItem *, const QPoint &, int)"), self.slotDouble)
     
     self.groups = QListView(tab)
     self.groups.addColumn(i18n("ID"))
     self.groups.setColumnAlignment(0, Qt.AlignRight)
     self.groups.addColumn(i18n("Group name"))
     self.groups.setResizeMode(QListView.LastColumn)
     self.groups.setAllColumnsShowFocus(True)
     self.connect(self.groups, SIGNAL("selectionChanged()"), self.slotSelect)
     
     tab.addTab(self.users, getIconSet("personal.png", KIcon.Small), i18n("Users"))
     tab.addTab(self.groups, getIconSet("kuser.png", KIcon.Small), i18n("Groups"))
     
     self.link = link
     link.call("User.Manager.userList", id=1)
     link.call("User.Manager.groupList", id=2)
     
     self.slotSelect()
Example #2
0
 def __init__(self, parent):
     QWidget.__init__(self, parent)
     self.setMargin(6)
     self.setSpacing(6)
     
     self.mainwidget = parent
     
     bar = QToolBar("lala", None, self)
     but = QToolButton(getIconSet("add.png"), i18n("Add"), "lala", parent.slotAdd, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     self.new_but = but
     bar.addSeparator()
     but = QToolButton(getIconSet("configure.png"), i18n("Edit"), "lala", parent.slotEdit, bar)
     self.edit_but = but
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     but = QToolButton(getIconSet("remove.png"), i18n("Delete"), "lala", self.slotDelete, bar)
     self.delete_but = but
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     bar.addSeparator()
     but = QToolButton(getIconSet("help.png"), i18n("Help"), "lala", self.slotHelp, bar)
     but.setUsesTextLabel(True)
     but.setTextPosition(but.BesideIcon)
     
     toggle = QCheckBox(i18n("Show system user and groups"), bar)
     toggle.setAutoMask(True)
     self.connect(toggle, SIGNAL("toggled(bool)"), self.slotToggle)
     
     tab = QTabWidget(self)
     self.connect(tab, SIGNAL("currentChanged(QWidget*)"), self.slotTabChanged)
     self.tab = tab
     tab.setMargin(6)
     
     self.users = QListView(tab)
     self.users.addColumn(i18n("ID"))
     self.users.setColumnAlignment(0, Qt.AlignRight)
     self.users.addColumn(i18n("User name"))
     self.users.addColumn(i18n("Full name"))
     self.users.setResizeMode(QListView.LastColumn)
     self.users.setAllColumnsShowFocus(True)
     self.connect(self.users, SIGNAL("selectionChanged()"), self.slotSelect)
     self.connect(self.users, SIGNAL("doubleClicked(QListViewItem *, const QPoint &, int)"), self.slotDouble)
     
     self.groups = QListView(tab)
     self.groups.addColumn(i18n("ID"))
     self.groups.setColumnAlignment(0, Qt.AlignRight)
     self.groups.addColumn(i18n("Group name"))
     self.groups.setResizeMode(QListView.LastColumn)
     self.groups.setAllColumnsShowFocus(True)
     self.connect(self.groups, SIGNAL("selectionChanged()"), self.slotSelect)
     
     tab.addTab(self.users, getIconSet("personal.png", KIcon.Small), i18n("Users"))
     tab.addTab(self.groups, getIconSet("kuser.png", KIcon.Small), i18n("Groups"))
     
     ch = self.mainwidget.callMethod("userList", "tr.org.pardus.comar.user.manager.get")
     ch.registerDone(self.comarUsers)
     ch.call()
     
     ch2 = self.mainwidget.callMethod("groupList", "tr.org.pardus.comar.user.manager.get")
     ch2.registerDone(self.comarGroups)
     ch2.call()
     
     self.showControls()
     
     self.slotSelect()