Ejemplo n.º 1
0
    def __init__(self, parent,  view, spaceId=None, boxId=None, orderNumber=None):
        gtk.Frame.__init__(self)

        self.par = parent
        self.viewId = view.getLocalId()
        self.spaceId = spaceId
        self.boxId = boxId
        self.orderNumber = orderNumber
        self.widgetId = None

        self.vbox = gtk.VBox()
        self.hbox = gtk.HBox(spacing=10)
        self.framelabel = FrameLabel(self,_("Space: "), SPACE)
        self.set_label_widget(self.framelabel)
        self.spacelabel = gtk.Label(_("Widget in this Space:"))

        self.widget_combo = ObjectCombo(self, "Widget", virtualRootObject=view.getViews().getSkarphed().getModules(), noneElement=True)
        self.expander = gtk.Expander()
        self.expander.set_label_widget(gtk.Label(_("Edit Widget Parameters")))
        self.param_widget = ParamWidget(self, view)
        self.expander.add(self.param_widget)
        self.hbox.pack_start(self.spacelabel,False)
        self.hbox.pack_start(self.widget_combo,False)
        self.vbox.pack_start(self.hbox,False)
        self.vbox.pack_start(self.expander,False)
        self.add(self.vbox)

        self.show_all()
        self.render()
Ejemplo n.º 2
0
    def __init__(self,
                 parent,
                 view,
                 spaceId=None,
                 boxId=None,
                 orderNumber=None):
        gtk.Frame.__init__(self)

        self.par = parent
        self.viewId = view.getLocalId()
        self.spaceId = spaceId
        self.boxId = boxId
        self.orderNumber = orderNumber
        self.widgetId = None

        self.vbox = gtk.VBox()
        self.hbox = gtk.HBox(spacing=10)
        self.framelabel = FrameLabel(self, _("Space: "), SPACE)
        self.set_label_widget(self.framelabel)
        self.spacelabel = gtk.Label(_("Widget in this Space:"))

        self.widget_combo = ObjectCombo(
            self,
            "Widget",
            virtualRootObject=view.getViews().getSkarphed().getModules(),
            noneElement=True)
        self.expander = gtk.Expander()
        self.expander.set_label_widget(gtk.Label(_("Edit Widget Parameters")))
        self.param_widget = ParamWidget(self, view)
        self.expander.add(self.param_widget)
        self.hbox.pack_start(self.spacelabel, False)
        self.hbox.pack_start(self.widget_combo, False)
        self.vbox.pack_start(self.hbox, False)
        self.vbox.pack_start(self.expander, False)
        self.add(self.vbox)

        self.show_all()
        self.render()
Ejemplo n.º 3
0
class SpaceWidget(gtk.Frame):
    def __init__(self, parent,  view, spaceId=None, boxId=None, orderNumber=None):
        gtk.Frame.__init__(self)

        self.par = parent
        self.viewId = view.getLocalId()
        self.spaceId = spaceId
        self.boxId = boxId
        self.orderNumber = orderNumber
        self.widgetId = None

        self.vbox = gtk.VBox()
        self.hbox = gtk.HBox(spacing=10)
        self.framelabel = FrameLabel(self,_("Space: "), SPACE)
        self.set_label_widget(self.framelabel)
        self.spacelabel = gtk.Label(_("Widget in this Space:"))

        self.widget_combo = ObjectCombo(self, "Widget", virtualRootObject=view.getViews().getSkarphed().getModules(), noneElement=True)
        self.expander = gtk.Expander()
        self.expander.set_label_widget(gtk.Label(_("Edit Widget Parameters")))
        self.param_widget = ParamWidget(self, view)
        self.expander.add(self.param_widget)
        self.hbox.pack_start(self.spacelabel,False)
        self.hbox.pack_start(self.widget_combo,False)
        self.vbox.pack_start(self.hbox,False)
        self.vbox.pack_start(self.expander,False)
        self.add(self.vbox)

        self.show_all()
        self.render()

    def render(self):
        try:
            view = self.getApplication().getLocalObjectById(self.viewId)
        except GenericObjectStoreException:
            self.destroy()
            return
        site = view.getPage()
        if self.spaceId is not None: # In case, this space is a real space
            spaceName = site.getNameOfSpace(self.spaceId)
            self.framelabel.setText(_("Space: ")+spaceName)
            spaceWidgetMapping = view.getSpaceWidgetMapping()
            try:
                widgetId = spaceWidgetMapping[str(self.spaceId)]
            except KeyError:
                widget = None
                widgetId = None
            else:
                widget = view.getViews().getSkarphed().getModules().getWidgetById(widgetId)
        else: #In case this space is only part of a box
            self.framelabel.setText(_("BoxSpace"))
            boxmapping = self.getPar().getPar().getTemporaryBoxContent()
            try:
                widgetId = boxmapping[self.orderNumber]
            except KeyError:
                widget = None
                widgetId = None
            else:
                widget = view.getViews().getSkarphed().getModules().getWidgetById(widgetId)

        self.widgetId = widgetId
        self.widget_combo.setSelected(widget)
        self.param_widget.setWidget(widget)
        self.param_widget.render()
    
    def getWidgetId(self):
        widget = self.widget_combo.getSelected()
        if widget is None:
            return None
        else:
            return widget.getId()

    def getWidget(self):
        widget = self.widget_combo.getSelected()
        if widget is None:
            return None
        else:
            return widget

    def getSpaceId(self):
        return self.spaceId

    def getWidgetCombo(self):
        return self.widget_combo

    def getSpaceId(self):
        return self.spaceId

    def getPar(self):
        return self.par

    def getApplication(self):
        return self.par.getApplication()
Ejemplo n.º 4
0
class SpaceWidget(gtk.Frame):
    def __init__(self,
                 parent,
                 view,
                 spaceId=None,
                 boxId=None,
                 orderNumber=None):
        gtk.Frame.__init__(self)

        self.par = parent
        self.viewId = view.getLocalId()
        self.spaceId = spaceId
        self.boxId = boxId
        self.orderNumber = orderNumber
        self.widgetId = None

        self.vbox = gtk.VBox()
        self.hbox = gtk.HBox(spacing=10)
        self.framelabel = FrameLabel(self, _("Space: "), SPACE)
        self.set_label_widget(self.framelabel)
        self.spacelabel = gtk.Label(_("Widget in this Space:"))

        self.widget_combo = ObjectCombo(
            self,
            "Widget",
            virtualRootObject=view.getViews().getSkarphed().getModules(),
            noneElement=True)
        self.expander = gtk.Expander()
        self.expander.set_label_widget(gtk.Label(_("Edit Widget Parameters")))
        self.param_widget = ParamWidget(self, view)
        self.expander.add(self.param_widget)
        self.hbox.pack_start(self.spacelabel, False)
        self.hbox.pack_start(self.widget_combo, False)
        self.vbox.pack_start(self.hbox, False)
        self.vbox.pack_start(self.expander, False)
        self.add(self.vbox)

        self.show_all()
        self.render()

    def render(self):
        try:
            view = self.getApplication().getLocalObjectById(self.viewId)
        except GenericObjectStoreException:
            self.destroy()
            return
        site = view.getPage()
        if self.spaceId is not None:  # In case, this space is a real space
            spaceName = site.getNameOfSpace(self.spaceId)
            self.framelabel.setText(_("Space: ") + spaceName)
            spaceWidgetMapping = view.getSpaceWidgetMapping()
            try:
                widgetId = spaceWidgetMapping[str(self.spaceId)]
            except KeyError:
                widget = None
                widgetId = None
            else:
                widget = view.getViews().getSkarphed().getModules(
                ).getWidgetById(widgetId)
        else:  #In case this space is only part of a box
            self.framelabel.setText(_("BoxSpace"))
            boxmapping = self.getPar().getPar().getTemporaryBoxContent()
            try:
                widgetId = boxmapping[self.orderNumber]
            except KeyError:
                widget = None
                widgetId = None
            else:
                widget = view.getViews().getSkarphed().getModules(
                ).getWidgetById(widgetId)

        self.widgetId = widgetId
        self.widget_combo.setSelected(widget)
        self.param_widget.setWidget(widget)
        self.param_widget.render()

    def getWidgetId(self):
        widget = self.widget_combo.getSelected()
        if widget is None:
            return None
        else:
            return widget.getId()

    def getWidget(self):
        widget = self.widget_combo.getSelected()
        if widget is None:
            return None
        else:
            return widget

    def getSpaceId(self):
        return self.spaceId

    def getWidgetCombo(self):
        return self.widget_combo

    def getSpaceId(self):
        return self.spaceId

    def getPar(self):
        return self.par

    def getApplication(self):
        return self.par.getApplication()
Ejemplo n.º 5
0
    def __init__(self, parent, role):
        ObjectPageAbstract.__init__(self, parent, role)

        role.fetchPermissions()

        self.headline = gtk.Label()
        self.pack_start(self.headline, False)

        self.info = PageFrame(self, _("Information"), gui.IconStock.ROLE)
        self.infobox = gtk.VBox()
        self.info.add(self.infobox)
        self.pack_start(self.info, False)

        self.perm = PageFrame(self, _("Permissions"), gui.IconStock.PERMISSION)
        self.permbox = gtk.Table(1, 2, False)
        self.permbox.set_row_spacings(10)
        self.permbox.set_col_spacings(10)
        self.permbox.set_border_width(10)

        self.perm_permlabel = FrameLabel(
            self,
            _("Please choose the Permissions you want to assign to the user here:"
              ), gui.IconStock.PERMISSION)

        self.perm_permlistview = gtk.TreeView()
        self.perm_permlist = gtk.ListStore(int, str, str)
        self.perm_permlistview.set_model(self.perm_permlist)
        self.perm_permlist_col_checkbox = gtk.TreeViewColumn('')
        self.perm_permlist_col_identifier = gtk.TreeViewColumn(
            _('Permission Identifier'))
        self.perm_permlist_col_name = gtk.TreeViewColumn(_('Permission Name'))
        self.perm_permlistview.append_column(self.perm_permlist_col_checkbox)
        self.perm_permlistview.append_column(self.perm_permlist_col_identifier)
        self.perm_permlistview.append_column(self.perm_permlist_col_name)
        self.perm_permlist_renderer_checkbox = gtk.CellRendererToggle()
        self.perm_permlist_renderer_identifier = gtk.CellRendererText()
        self.perm_permlist_renderer_name = gtk.CellRendererText()

        self.perm_permlist_col_checkbox.pack_start(
            self.perm_permlist_renderer_checkbox)
        self.perm_permlist_col_identifier.pack_start(
            self.perm_permlist_renderer_identifier)
        self.perm_permlist_col_name.pack_start(
            self.perm_permlist_renderer_name)
        self.perm_permlist_col_checkbox.add_attribute(
            self.perm_permlist_renderer_checkbox, 'active', 0)
        self.perm_permlist_col_identifier.add_attribute(
            self.perm_permlist_renderer_identifier, 'text', 1)
        self.perm_permlist_col_name.add_attribute(
            self.perm_permlist_renderer_name, 'text', 2)
        self.perm_permlist_renderer_checkbox.set_activatable(True)
        self.perm_permlist_renderer_checkbox.connect("toggled",
                                                     self.toggledRight)

        self.permbox.attach(self.perm_permlabel, 0, 1, 0, 1)
        self.permbox.attach(self.perm_permlistview, 0, 1, 1, 2)

        self.perm.add(self.permbox)
        self.pack_start(self.perm, False)

        self.show_all()

        self.render()
Ejemplo n.º 6
0
    def __init__(self, par, user):
        ObjectPageAbstract.__init__(self, par, user)

        user.fetchRightsData()
        user.fetchRoleData()

        self.headline = gtk.Label()
        self.pack_start(self.headline, False)

        self.info = PageFrame(self, _("Information"), gui.IconStock.USER)
        self.infobox = gtk.VBox()
        self.info.add(self.infobox)
        self.pack_start(self.info, False)

        self.perm = PageFrame(self, _("Permissions / Roles"),
                              gui.IconStock.ROLE)
        self.permbox = gtk.Table(2, 2, False)
        self.permbox.set_row_spacings(10)
        self.permbox.set_col_spacings(10)
        self.permbox.set_border_width(10)

        self.perm_permlabel = FrameLabel(
            self,
            _("Please choose the Permissions you want to assign to the user here:"
              ), gui.IconStock.PERMISSION)
        self.perm_rolelabel = FrameLabel(
            self,
            _("Please choose the Rights you want to assign to the user here:"),
            gui.IconStock.ROLE)

        self.perm_permlistview = gtk.TreeView()
        self.perm_permlist = gtk.ListStore(int, str, str)
        self.perm_permlistview.set_model(self.perm_permlist)
        self.perm_permlist_col_checkbox = gtk.TreeViewColumn('')
        self.perm_permlist_col_identifier = gtk.TreeViewColumn(
            _('Permission Identifier'))
        self.perm_permlist_col_name = gtk.TreeViewColumn(_('Permission Name'))
        self.perm_permlistview.append_column(self.perm_permlist_col_checkbox)
        self.perm_permlistview.append_column(self.perm_permlist_col_identifier)
        self.perm_permlistview.append_column(self.perm_permlist_col_name)
        self.perm_permlist_renderer_checkbox = gtk.CellRendererToggle()
        self.perm_permlist_renderer_identifier = gtk.CellRendererText()
        self.perm_permlist_renderer_name = gtk.CellRendererText()

        self.perm_permlist_col_checkbox.pack_start(
            self.perm_permlist_renderer_checkbox)
        self.perm_permlist_col_identifier.pack_start(
            self.perm_permlist_renderer_identifier)
        self.perm_permlist_col_name.pack_start(
            self.perm_permlist_renderer_name)
        self.perm_permlist_col_checkbox.add_attribute(
            self.perm_permlist_renderer_checkbox, 'active', 0)
        self.perm_permlist_col_identifier.add_attribute(
            self.perm_permlist_renderer_identifier, 'text', 1)
        self.perm_permlist_col_name.add_attribute(
            self.perm_permlist_renderer_name, 'text', 2)
        self.perm_permlist_renderer_checkbox.set_activatable(True)
        self.perm_permlist_renderer_checkbox.connect("toggled",
                                                     self.toggledRight)

        self.perm_rolelistview = gtk.TreeView()
        self.perm_rolelist = gtk.ListStore(int, str, str, int)
        self.perm_rolelistview.set_model(self.perm_rolelist)
        self.perm_rolelist_col_checkbox = gtk.TreeViewColumn('')
        self.perm_rolelist_col_identifier = gtk.TreeViewColumn(
            _('Role Identifier'))
        self.perm_rolelist_col_name = gtk.TreeViewColumn(_('RoleName'))
        self.perm_rolelistview.append_column(self.perm_rolelist_col_checkbox)
        self.perm_rolelistview.append_column(self.perm_rolelist_col_identifier)
        self.perm_rolelistview.append_column(self.perm_rolelist_col_name)
        self.perm_rolelist_renderer_checkbox = gtk.CellRendererToggle()
        self.perm_rolelist_renderer_identifier = gtk.CellRendererText()
        self.perm_rolelist_renderer_name = gtk.CellRendererText()

        self.perm_rolelist_col_checkbox.pack_start(
            self.perm_rolelist_renderer_checkbox)
        self.perm_rolelist_col_identifier.pack_start(
            self.perm_rolelist_renderer_identifier)
        self.perm_rolelist_col_name.pack_start(
            self.perm_rolelist_renderer_name)
        self.perm_rolelist_col_checkbox.add_attribute(
            self.perm_rolelist_renderer_checkbox, 'active', 0)
        self.perm_rolelist_col_identifier.add_attribute(
            self.perm_rolelist_renderer_identifier, 'text', 1)
        self.perm_rolelist_col_name.add_attribute(
            self.perm_rolelist_renderer_name, 'text', 2)
        self.perm_rolelist_renderer_checkbox.set_activatable(True)
        self.perm_rolelist_renderer_checkbox.connect("toggled",
                                                     self.toggledRole)

        self.permbox.attach(self.perm_permlabel, 0, 1, 0, 1)
        self.permbox.attach(self.perm_permlistview, 0, 1, 1, 2)
        self.permbox.attach(self.perm_rolelabel, 1, 2, 0, 1)
        self.permbox.attach(self.perm_rolelistview, 1, 2, 1, 2)

        self.perm.add(self.permbox)
        self.pack_start(self.perm, False)

        self.alterpw = PageFrame(self, _("Alter Password"),
                                 gui.IconStock.CREDENTIAL)
        self.alterpwhbox = gtk.HBox()
        self.alterpwdummy = gtk.Label("")
        self.alterpwbox = gtk.Table(2, 4, False)
        self.alterpwbox.set_row_spacings(10)
        self.alterpwbox.set_col_spacings(10)
        self.alterpwbox.set_border_width(10)
        self.alterpw_oldpw_label = gtk.Label(_("Old Password:"******"New Password:"******"Repeat Password:"******"●")
        self.alterpw_oldpw_entry.set_visibility(False)
        self.alterpw_newpw1_entry = gtk.Entry()
        self.alterpw_newpw1_entry.set_invisible_char("●")
        self.alterpw_newpw1_entry.set_visibility(False)
        self.alterpw_newpw2_entry = gtk.Entry()
        self.alterpw_newpw2_entry.set_invisible_char("●")
        self.alterpw_newpw2_entry.set_visibility(False)
        self.alterpw_ok = gtk.Button(_("Alter Password"))
        self.alterpwbox.attach(self.alterpw_oldpw_label, 0, 1, 0, 1)
        self.alterpwbox.attach(self.alterpw_oldpw_entry, 1, 2, 0, 1)
        self.alterpwbox.attach(self.alterpw_newpw1_label, 0, 1, 1, 2)
        self.alterpwbox.attach(self.alterpw_newpw1_entry, 1, 2, 1, 2)
        self.alterpwbox.attach(self.alterpw_newpw2_label, 0, 1, 2, 3)
        self.alterpwbox.attach(self.alterpw_newpw2_entry, 1, 2, 2, 3)
        self.alterpwbox.attach(self.alterpw_ok, 1, 2, 3, 4)
        self.alterpwhbox.pack_start(self.alterpwbox, False)
        self.alterpwhbox.pack_start(self.alterpwdummy, True)
        self.alterpw.add(self.alterpwhbox)
        self.alterpw_ok.connect("clicked", self.alterPassword)
        self.pack_start(self.alterpw, False)

        self.show_all()

        self.render()