コード例 #1
0
    def editUser(self, uid):
        # Check if the user has propper permissions and present a nice message if not
        # This is ofcourse also checked on the server side.
        may_open = False
        if uid == cm.get_binded_user() and accesstools.check_permission("user.self.modify", False):
            may_open = True
        elif accesstools.check_permission_multi_or(("user.modify", "user.view")):
            may_open = True

        if may_open == False:
            return

        if self.useredits.has_key(uid):
            self.tabwidget.setCurrentWidget(self.useredits[uid])
            return
        import usereditwdg as usered

        useredit = usered.UserEditWdg(uid, self.tabwidget)
        self.useredits[useredit] = uid
        self.useredits[uid] = useredit
        tab_title = useredit.led_firstname.text() + " " + useredit.led_lastname.text()

        usericon = paths.path_to("art/student.svg")
        if os.path.exists(paths.path_to("art/%s.svg") % userdef.usertype_as_text(useredit.user_info["usertype_id"])):
            usericon = paths.path_to("art/%s.svg") % userdef.usertype_as_text(useredit.user_info["usertype_id"])
        self.tabwidget.addTab(useredit, QtGui.QIcon(qt4tools.svg2pixmap(usericon, 32, 32)), tab_title)
        self.tabwidget.setCurrentWidget(useredit)
コード例 #2
0
	def __init__(self,parent):
		QtGui.QWidget.__init__(self,parent)
		ar.ActionRequester.__init__(self)
		self.setupUi(self)
		self.btn_new_user.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to('art/new_user.svg'),72,72)))
		self.connect(self.btn_new_user,QtCore.SIGNAL("clicked()"),self.execCreateUserWizard)
		self.connect(self.btn_new_group,QtCore.SIGNAL("clicked()"),self.execCreateGroupWizard)
		self.connect(self.btn_open_fileman,QtCore.SIGNAL("clicked()"),self.openFileManager)
		self.connect(mainwin.get_mainwindow(),QtCore.SIGNAL("permissionsChanged"),self.setupPermissions)
		self.btn_new_group.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to('art/new_group.svg'),72,72)))
		self.btn_open_fileman.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to('art/stats.svg'),72,72)))
		self.setupPermissions(cm.get_proxy_handle().list_my_permissions())
コード例 #3
0
    def setupActions(self):
        # Actions

        a = self.addAction("import_users", self.tr("Import users..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.importUsers)
        a.setDisabled(True)

        a = self.addAction("export_users", self.tr("Export users..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.exportUsers)
        a.setDisabled(True)

        a = self.addAction("export_groups", self.tr("Export groups..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.exportGroups)
        a.setDisabled(True)

        a = self.addAction("exit", self.tr("Exit"))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.close)

        a = self.addAction("open_filemanager", self.tr("File manager"))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.openFileManager)
        a.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/stats.svg"), 16, 16)))

        a = self.addAction("exec_creategroupwizard", self.tr("Create group..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.execCreateGroupWizard)
        a.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/new_group.svg"), 16, 16)))

        a = self.addAction("exec_createuserwizard", self.tr("Create user..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.execCreateUserWizard)
        a.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/new_user.svg"), 16, 16)))

        a = self.addAction("exec_accessmanager", self.tr("Access Manager..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.execAccessManager)
        a.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/access.svg"), 16, 16)))

        a = self.addAction("exec_update_permissions", self.tr("Update permissions..."))
        self.connect(a, QtCore.SIGNAL("triggered()"), self.execUpdatePermissions)
        # a.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to('art/access.svg'),16,16)))

        a = self.addAction("show_users", self.tr("Show Users"))
        a.setCheckable(True)
        self.connect(a, QtCore.SIGNAL("toggled(bool)"), self.showUserView)

        a = self.addAction("show_groups", self.tr("Show Groups"))
        a.setCheckable(True)
        self.connect(a, QtCore.SIGNAL("toggled(bool)"), self.showGroupView)

        self.connect(self, QtCore.SIGNAL("permissionsChanged"), self.setupPermissions)
コード例 #4
0
 def __init__(self, parent):
     QtGui.QWidget.__init__(self, parent)
     self.setupUi(self)
     self.connect(self.btn_login, QtCore.SIGNAL("clicked()"), self.accept)
     self.connect(self.ed_username, QtCore.SIGNAL("returnPressed()"), self.ed_passwd.setFocus)
     self.connect(self.ed_passwd, QtCore.SIGNAL("returnPressed()"), self.accept)
     self.btn_login.setDefault(False)
     self.btn_login.setAutoDefault(False)
     self.setFixedSize(self.size())
     self.lbl_logo.setPixmap(QtGui.QPixmap(paths.path_to("art/biglogo.png"), "PNG"))
コード例 #5
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)
コード例 #6
0
    def __init__(self, parent):
        self.setupCentralTabWidget()
        mainwin.MainWindow.__init__(self, parent, self.tabwidget)

        self.old_access_idents = []
        self.groupview = None
        self.userview = None
        self.filemanager = None
        self.accessmanager = None
        self.useredits = {}
        self.groupedits = {}
        self.setupActions()
        self.setupMenus()
        self.setupToolBars()
        self.startPermissionMonitor()
        self.setWindowTitle(self.tr("SkoleSYS Administration"))

        self.btn_closetab = QtGui.QToolButton(self.tabwidget)
        self.btn_closetab.setAutoRaise(True)
        self.btn_closetab.setIcon(QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/close.svg"), 10, 10)))
        self.connect(self.btn_closetab, QtCore.SIGNAL("clicked()"), self.removeTab)
        self.tabwidget.setCornerWidget(self.btn_closetab)
        self.setWindowIcon(QtGui.QIcon(paths.path_to("art/icons/hicolor/22x22/apps/skolesys-qt4.png")))
        self.setupPermissions(cm.get_proxy_handle().list_my_permissions())
コード例 #7
0
    def setupViews(self):
        import tooltabwdg as tooltab
        import groupviewwdg as groupview
        import userviewwdg as userview

        self.groupview = groupview.GroupViewWdg(None)
        self.connect(self.groupview, QtCore.SIGNAL("viewShown"), self.action("show_groups").setChecked)
        self.groupviewdock = self.insertDockWidget(self.groupview, self.tr("Groups"))
        self.userview = userview.UserViewWdg(None)
        self.connect(self.userview, QtCore.SIGNAL("viewShown"), self.action("show_users").setChecked)
        self.userviewdock = self.insertDockWidget(self.userview, self.tr("Users"))

        tooltab = tooltab.ToolTabWdg(self.tabwidget)
        self.tabwidget.addTab(
            tooltab, QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/kfm_home.svg"), 16, 16)), self.tr("Home")
        )
コード例 #8
0
    def openFileManager(self):
        # Check if the user has propper permissions and present a nice message if not
        # This is ofcourse also checked on the server side.
        if not accesstools.check_permission("file.browse"):
            return

        if self.filemanager != None:
            self.tabwidget.setCurrentWidget(self.filemanager)
            return

        import filemanagerwdg as fileman

        self.filemanager = fileman.FileManagerWdg(self.tabwidget)
        tab_title = self.tr("File manager")
        self.tabwidget.addTab(
            self.filemanager, QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/stats.svg"), 16, 16)), tab_title
        )
        self.tabwidget.setCurrentWidget(self.filemanager)
コード例 #9
0
    def editGroup(self, groupname, displayed_name):
        # Check if the user has propper permissions and present a nice message if not
        # This is ofcourse also checked on the server side.
        if not accesstools.check_permission_multi_or(("group.modify", "group.view")):
            return
        if self.groupedits.has_key(groupname):
            self.tabwidget.setCurrentWidget(self.groupedits[groupname])
            return
        import groupeditwdg as grouped

        groupedit = grouped.GroupEditWdg(groupname, self.tabwidget)
        self.groupedits[groupedit] = groupname
        self.groupedits[groupname] = groupedit
        tab_title = QtCore.QString.fromUtf8(
            displayed_name
        )  # groupedit.led_firstname.text()+" "+groupedit.led_lastname.text()
        self.tabwidget.addTab(
            groupedit, QtGui.QIcon(qt4tools.svg2pixmap(paths.path_to("art/group.svg"), 16, 16)), tab_title
        )
        self.tabwidget.setCurrentWidget(groupedit)
コード例 #10
0
	def _addGroup(self,gid,groupname,displayed_name,grouptype_id):
		if self.groups.has_key(int(gid)):
			return
		self.insertRow(self.rowCount())
		idx = self.index(self.rowCount()-1,self.columninfo['displayed_name']['columnindex'])
		self.setData(idx,QtCore.QVariant(qt4tools.svg2pixmap(paths.path_to('art/group.svg'),24,24)),QtCore.Qt.DecorationRole)
		self.setData(idx,QtCore.QVariant(QtCore.QString.fromUtf8(displayed_name)))
		self.setData(idx,QtCore.QVariant(gid),QtCore.Qt.UserRole)
		idx = self.index(self.rowCount()-1,self.columninfo['groupname']['columnindex'])
		self.setData(idx,QtCore.QVariant(QtCore.QString.fromUtf8(groupname)))
		idx = self.index(self.rowCount()-1,self.columninfo['gid']['columnindex'])
		self.setData(idx,QtCore.QVariant(gid))
		idx = self.index(self.rowCount()-1,self.columninfo['grouptype']['columnindex'])
		self.setData(idx,QtCore.QVariant(self.tr(groupdef.grouptype_as_text(grouptype_id),"singular")))
		
		idx = self.index(self.rowCount()-1,0)
		self.setData(idx,QtCore.QVariant(gid),QtCore.Qt.UserRole)
		
		self.groups[int(gid)] = {
			'gid':gid,
			'groupname':groupname,
			'displayed_name':displayed_name,
			'grouptype_id':grouptype_id}
コード例 #11
0
	help="Start program with danish languagesettings", metavar="LANG")

(options, args) = parser.parse_args()

if not options.lang:
	options.lang = 'en'
	if os.environ.has_key('LANG'):
		options.lang = os.environ['LANG'][:2]

app = QtGui.QApplication(sys.argv)

if options.lang:
	trans = QtCore.QTranslator()
	#print __file__
	#appdir = os.path.split(__file__)[0]
	lang_file = paths.path_to('skolesys-qt4_%s.qm') % (options.lang)
	print lang_file
	loadres = trans.load(lang_file)
	if not loadres:
		print "Failed to load language file: %s" % lang_file
	else:
		app.installTranslator(trans)
	
	servermsg.init_server_messages(options.lang)

cm.setup_connection('https://10.1.0.1',10033)

ui = ss_mainwin.get_mainwindow()

if ui:
	ui.setupViews()
コード例 #12
0
ファイル: terrain.py プロジェクト: ronaldoamaral/nsi_site
def i_go_to(step, page_name):
    world.browser.visit(path_to(page_name))
コード例 #13
0
def i_go_to(step, page_name):
    world.browser.visit(path_to(page_name))