def setup(self):
		# login restriction
		rx = QRegExp('^[a-z][._0-9a-z]*')
		rx_validator = QRegExpValidator(rx,self)
		self.ed_login.setValidator(rx_validator)
		# present the domain name (This has been removed for the sake of smaller pupils)
		# self.lbl_domain_name.setText('@%s' % self.proxy.domain_name())
		self.connect(self.ed_login,SIGNAL("textChanged(const QString&)"),self.check_login)
		self.connect(self.cmb_usertype,SIGNAL("activated(int)"),self.usertype_changed)
		
		thisyear = QDateTime.currentDateTime().date().year()
		self.sbx_firstschoolyear.setValue(thisyear)
		self.sbx_firstschoolyear.setMinValue(thisyear-15)
		self.sbx_firstschoolyear.setMaxValue(thisyear+3)

		setupdict = {}
		self.typedict = {}
		for type_text in userdef.list_usertypes_by_text():
			self.typedict[self.tr(type_text).latin1()] = userdef.usertype_as_id(type_text)
			setupdict[type_text] = { 
				'id': userdef.usertype_as_id(type_text),
				'display': self.tr(type_text).latin1() }
		
		for usertype_text in config.usertype_order:
			if setupdict.has_key(usertype_text):
				self.cmb_usertype.insertItem(setupdict[usertype_text]['display'])
		
		self.usertype_changed()
		self.groups_to_combo()
Пример #2
0
	def __init__(self,parent):
		esm.EnhancedStandardItemModel.__init__(self,parent)
		self.proxy = cm.get_proxy_handle()
		self.users = {}
		self.columninfo = {
			'uidnumber': {'text': self.tr('User ID'), 'columnindex': 3},
			'uid': {'text': self.tr('Login'), 'columnindex': 1},
			'cn': {'text': self.tr('User name'), 'columnindex': 0},
			'usertype': {'text': self.tr('User type'), 'columnindex': 2} }
		self.initialSetup()
		self.tr("teacher","singular")
		self.tr("student","singular")
		self.tr("parent","singular")
		self.tr("other","singular")
		default_icon = paths.path_to('art/student.svg')
		self.icons = {}
		for usertype in userdef.list_usertypes_by_text():
			icon = default_icon
			if os.path.exists(paths.path_to('art/%s.svg') % usertype):
				icon = paths.path_to('art/%s.svg') % usertype
			self.icons[userdef.usertype_as_id(usertype)] = qt4tools.svg2pixmap(icon,24,24)
	def __init__(self,conn,parent = None,name = None,fl = 0):
		self.classyear_filter_enabled = False
		self.group_filter_enabled = False
		self.group_members = []
		UserManagerWdgBase.__init__(self,parent,name,fl)
		self.m_lv_userlist.addColumn(self.tr("Name"))
		self.m_lv_userlist.addColumn(self.tr("Type"))
		self.m_lv_userlist.addColumn(self.tr("Login"))
		
		self.conn = conn # For passing on to create/remove users
		self.soapproxy = conn.get_proxy_handle()
		self.userlist = []
		self.update_list()
		self.contextmenu_enabled = True

		# setup usertype combo
		setupdict = {}
		self.typedict = {}
		for type_text in userdef.list_usertypes_by_text():
			self.typedict[self.tr(type_text).latin1()] = userdef.usertype_as_id(type_text)
			setupdict[type_text] = self.tr(type_text).latin1()

		self.typedict[self.tr('all').latin1()] = None
		setupdict['all'] = self.tr('all').latin1()
		self.connect(self.m_cb_usertype_filter,SIGNAL("activated(int)"),self.slot_usertype_changed)
		self.connect(self.cmb_groupfilter,SIGNAL("activated(int)"),self.slot_groupfilter_changed)
		self.connect(self.sbx_firstschoolyear_min,SIGNAL("valueChanged(int)"),self.slot_classyear_span_changed)
		self.connect(self.sbx_firstschoolyear_max,SIGNAL("valueChanged(int)"),self.slot_classyear_span_changed)
		
		typeorder = ['all'] + config.usertype_order
		for usertype_text in typeorder:
			if setupdict.has_key(usertype_text):
				self.m_cb_usertype_filter.insertItem(setupdict[usertype_text])
		
		# Setup group combo
		self.groups_to_combo()