def __init__(self, main, form, *args, **kwargs):
        from ProvCon.dbui.wxwin.art import BITMAPS
        wx.Panel.__init__(self, main, *args, **kwargs)
        sizer = wx.BoxSizer (wx.VERTICAL)
        
        self.main = main
        self.form = form
        self.buttons = AttrDict()
        self.buttons.new_subscriber = wx.BitmapButton ( self, bitmap = BITMAPS.ADDUSER, style=wx.NO_BORDER )
        self.buttons.new_subscriber.SetToolTipString ( "Dodaj nowego klienta" )
        
        self.buttons.new_service = wx.BitmapButton ( self, bitmap = BITMAPS.ADDSERVICE, style=wx.NO_BORDER )
        self.buttons.new_service.SetToolTipString ( "Dodaj nową usługę" )

        self.buttons.new_issue = wx.BitmapButton ( self, bitmap = BITMAPS.SUPPORT, style=wx.NO_BORDER )
        self.buttons.new_issue.SetToolTipString ( "Nowe zgłoszenie" )
        
        #self.buttons.new_device = wx.Button ( self, label = "Nowe\nurządzenie", style=wx.NO_BORDER )        
        #self.buttons.cos_change = wx.Button ( self, label = "Zmiana\npakietu", style=wx.NO_BORDER )
        #self.buttons.status_change = wx.Button ( self, label = "Diagnostyka", style=wx.NO_BORDER )
        #self.buttons.diagnostics = wx.Button ( self, label = "Blokady", style=wx.NO_BORDER )
        #self.buttons.service_change = wx.Button ( self, label = "Przełączenie", style=wx.NO_BORDER )
        #self.buttons.equipment_change = wx.Button ( self, label = "Wymiana\nsprzętu", style=wx.NO_BORDER )
        
        for b, bt in self.buttons.inorder():            
            sizer.Add ( bt,0, flag=wx.EXPAND)
            if hasattr(self, "on_" + b): 
                bt.Bind (wx.EVT_BUTTON, partial(self._run_handler, "on_" + b ) )
        
        sizer.AddStretchSpacer (10)
        
        self.SetSizer(sizer)

        self.new_subscriber_dialog = None        
示例#2
0
    def OnInit(self):
        self.windows = AttrDict()
        self.forms = AttrDict()
        self.windows.toplevel = wx.Frame(None,
                                         title="Provisioning",
                                         size=(1100, 900))

        sizer = wx.BoxSizer(wx.VERTICAL)

        notebook = wx.Notebook(self.windows.toplevel)
        self.windows.notebook = notebook

        #welcome = html.HtmlWindow ( notebook )
        #self.windows.welcome = welcome
        #welcome.SetPage ( """
        #<br/><center>
        #<H1>NETCON 3.0 Panel administracyjny</H1>
        #<h2>$Revision$</h2>
        #</center>
        #<br/><br/>
        #""" )
        #notebook.AddPage ( welcome, "Powitanie" )

        ##LOCATIONS
        #locations = controls.LocationEditor ( notebook )
        #self.windows.locations = locations
        #notebook.AddPage ( locations, "Lokalizacje" )

        #self.forms.subseditor = guitk.complete.CompleteGenericForm ( notebook,
        #                                                       tablename="subscriber"
        #                                                      )
        subscriber = SubscriberMain(notebook)
        notebook.AddPage(subscriber, "Klient")

        device = DeviceMain(notebook)
        notebook.AddPage(device, "Urządzenie")

        #datastore = wx.Panel(notebook)
        #notebook.AddPage (datastore, "DATA STORE")

        sizer.Add(self.windows.notebook, 4, flag=wx.EXPAND)
        self.windows.toplevel.SetSizer(sizer)
        self.windows.toplevel.Show()

        return True
示例#3
0
    def __init__(self, main, form, *args, **kwargs):
        from ProvCon.dbui.wxwin.art import BITMAPS
        wx.Panel.__init__(self, main, *args, **kwargs)
        sizer = wx.BoxSizer(wx.VERTICAL)

        self.main = main
        self.form = form
        self.buttons = AttrDict()
        self.buttons.new_subscriber = wx.BitmapButton(self,
                                                      bitmap=BITMAPS.ADDUSER,
                                                      style=wx.NO_BORDER)
        self.buttons.new_subscriber.SetToolTipString("Dodaj nowego klienta")

        self.buttons.new_service = wx.BitmapButton(self,
                                                   bitmap=BITMAPS.ADDSERVICE,
                                                   style=wx.NO_BORDER)
        self.buttons.new_service.SetToolTipString("Dodaj nową usługę")

        self.buttons.new_issue = wx.BitmapButton(self,
                                                 bitmap=BITMAPS.SUPPORT,
                                                 style=wx.NO_BORDER)
        self.buttons.new_issue.SetToolTipString("Nowe zgłoszenie")

        #self.buttons.new_device = wx.Button ( self, label = "Nowe\nurządzenie", style=wx.NO_BORDER )
        #self.buttons.cos_change = wx.Button ( self, label = "Zmiana\npakietu", style=wx.NO_BORDER )
        #self.buttons.status_change = wx.Button ( self, label = "Diagnostyka", style=wx.NO_BORDER )
        #self.buttons.diagnostics = wx.Button ( self, label = "Blokady", style=wx.NO_BORDER )
        #self.buttons.service_change = wx.Button ( self, label = "Przełączenie", style=wx.NO_BORDER )
        #self.buttons.equipment_change = wx.Button ( self, label = "Wymiana\nsprzętu", style=wx.NO_BORDER )

        for b, bt in self.buttons.inorder():
            sizer.Add(bt, 0, flag=wx.EXPAND)
            if hasattr(self, "on_" + b):
                bt.Bind(wx.EVT_BUTTON, partial(self._run_handler, "on_" + b))

        sizer.AddStretchSpacer(10)

        self.SetSizer(sizer)

        self.new_subscriber_dialog = None
    def __init__(self, parent, form, *args, **kwargs):
        from ProvCon.dbui.wxwin.art import BITMAPS
        wx.Panel.__init__(self, parent, *args, **kwargs)
        self.form = form
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        font18 = wx.Font (18, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        font20 = wx.Font (20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        font20b = wx.Font (20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
        font22b = wx.Font (22, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)
        
        self.edit = AttrDict()
        self.edit.subscriberid = Entry.Static ( self.form.table["subscriberid"], self, variable = self.form.getvar("subscriberid" ) )
        self.edit.name = Entry.Static ( self.form.table["name"], self, variable = self.form.getvar("name" ) )
        self.edit.primarylocation = Entry.StaticReference ( self.form.table["primarylocationid"], self, variable = self.form.getvar("primarylocationid" ) )
        
        for ctrl in self.edit.values():            
            ctrl.SetForegroundColour (wx.Color(0,0,0))
            ctrl.SetFont ( font18 )                
        self.edit.subscriberid.SetFont ( font22b )
        
        self.row_1 = rcs.RowColSizer()
        self.row_1.Add ( self.edit.subscriberid, row=1, col=1, rowspan=2, border=30, flag=wx.EXPAND )
        self.row_1.Add ( self.edit.name, row=1,col=2, flag=wx.EXPAND)
        self.row_1.Add ( self.edit.primarylocation, row=2,col=2, flag=wx.EXPAND)

        self.sizer.Add (self.row_1,10,flag=wx.EXPAND)

        ##Save option
        self.row_2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.row_2.Add ( wx.StaticBitmap (self, bitmap=BITMAPS.WRITE) )
        
        self.row_2.AddStretchSpacer(5)

        txt = wx.StaticText ( self, label="DANE ZOSTAŁY ZMIENIONE")
        #txt.Font = font18        
        self.row_2.Add ( txt, flag=wx.ALIGN_CENTER_VERTICAL )
        
        self.row_2.AddSpacer ( 40 )

        btn = wx.BitmapButton ( self, bitmap=BITMAPS.WRITE)
        btn.Bind (wx.EVT_BUTTON, self.doSave)
        self.row_2.Add ( btn, flag=wx.ALIGN_CENTER_VERTICAL)
        
        self.row_2.AddSpacer ( 40 )        
        
        self.sizer.Add ( self.row_2,0,wx.EXPAND)
                        
        self.SetSizer (self.sizer)        
        self.sizer.Hide(self.row_2)
    def __init__(self, parent, *args):
        from ProvCon.dbui.di import rDevice
        wx.Panel.__init__(self, parent, *args)

        self.form = AttrDict()
        self.table = AttrDict()
        self.editor = AttrDict()
        self.store = AttrDict()
        self.recordlist = AttrDict()

        self.dialogs = AttrDict()

        self.table.device = meta.Table.Get("device")
        print self.table.device.subclasses

        self.form.device = orm.Form(self.table.device, recordclass=rDevice)
        self.devicerecord.enableChildren()

        self.mgr = wx.aui.AuiManager()
        self.mgr.SetManagedWindow(self)
    def __init__(self, field, parent, *args, **kwargs):
        from ProvCon.dbui.orm import Record
        BaseReferenceEditor.__init__(self,
                                     field,
                                     getrecords=False,
                                     *args,
                                     **kwargs)
        wx.CollapsiblePane.__init__(self,
                                    parent,
                                    style=wx.CP_DEFAULT_STYLE
                                    | wx.CP_NO_TLW_RESIZE)

        self._current = AttrDict()
        self._dialogs = AttrDict()

        self._current.city = Record.EMPTY("city")
        self._current.street = Record.EMPTY("street")
        self._current.building = Record.EMPTY("building")
        self._current.location = Record.EMPTY("location")

        self._widgets = AttrDict()
        self._store = AttrDict()
        self._hooks = AttrDict()

        pane = self.GetPane()

        sizer = wx.BoxSizer(wx.VERTICAL)

        self._store.city = APP.DataStore.city
        self._widgets.city = mwx.RecordListCombo(pane, self._store.city)
        self._hooks.city_change = self._widgets.city.listenForEvent(
            "current_record_changed", partial(self.ref_record_changed, "city"))
        self._hooks.city_command = self._widgets.city.listenForEvent(
            "keyboard_command", partial(self.ref_keyboard_command, "city"))
        self._widgets.city.Bind(wx.EVT_RIGHT_DOWN, partial(self.add, "city"))
        sizer.Add(self._widgets.city, flag=wx.EXPAND)

        self._store.street = orm.RecordListView(APP.DataStore.street)
        self._widgets.street = mwx.RecordListCombo(pane, self._store.street)
        self._hooks.street_change = self._widgets.street.listenForEvent(
            "current_record_changed", partial(self.ref_record_changed,
                                              "street"))
        self._hooks.street_command = self._widgets.street.listenForEvent(
            "keyboard_command", partial(self.ref_keyboard_command, "street"))
        self._widgets.street.Bind(wx.EVT_RIGHT_DOWN,
                                  partial(self.add, "street"))
        sizer.Add(self._widgets.street, flag=wx.EXPAND)

        self._store.building = orm.RecordListView(APP.DataStore.building)
        self._widgets.building = mwx.RecordListCombo(pane,
                                                     self._store.building)
        self._hooks.building_change = self._widgets.building.listenForEvent(
            "current_record_changed",
            partial(self.ref_record_changed, "building"))
        self._hooks.building_command = self._widgets.building.listenForEvent(
            "keyboard_command", partial(self.ref_keyboard_command, "building"))
        self._widgets.building.Bind(wx.EVT_RIGHT_DOWN,
                                    partial(self.add, "building"))
        sizer.Add(self._widgets.building, flag=wx.EXPAND)

        self._store.location = orm.RecordListView(APP.DataStore.location)
        self._widgets.location = mwx.RecordListCombo(pane,
                                                     self._store.location)
        self._hooks.location_change = self._widgets.location.listenForEvent(
            "current_record_changed",
            partial(self.ref_record_changed, "location"))
        self._hooks.location_command = self._widgets.location.listenForEvent(
            "keyboard_command", partial(self.ref_keyboard_command, "location"))
        self._widgets.location.Bind(wx.EVT_RIGHT_DOWN,
                                    partial(self.add, "location"))
        sizer.Add(self._widgets.location, flag=wx.EXPAND)

        btsizer = wx.BoxSizer(wx.HORIZONTAL)

        self._widgets.save = wx.Button(pane, size=(-1, 30), label="Ustaw")
        self._widgets.save.Bind(wx.EVT_BUTTON, self.save)
        btsizer.Add(self._widgets.save, 1, flag=wx.EXPAND)

        self._widgets.revert = wx.Button(pane, size=(-1, 30), label="Przywróć")
        btsizer.Add(self._widgets.revert, 1, flag=wx.EXPAND)

        sizer.Add(btsizer, flag=wx.EXPAND)

        self._widgets.street.Enabled = False
        self._widgets.building.Enabled = False
        self._widgets.location.Enabled = False

        pane.SetSizer(sizer)

        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneToggled)
示例#7
0
    def __init__(self, parent, form, *args, **kwargs):
        from ProvCon.dbui.wxwin.art import BITMAPS
        wx.Panel.__init__(self, parent, *args, **kwargs)
        self.form = form
        self.sizer = wx.BoxSizer(wx.VERTICAL)

        font18 = wx.Font(18, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
                         wx.FONTWEIGHT_NORMAL)
        font20 = wx.Font(20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
                         wx.FONTWEIGHT_NORMAL)
        font20b = wx.Font(20, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
                          wx.FONTWEIGHT_BOLD)
        font22b = wx.Font(22, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL,
                          wx.FONTWEIGHT_BOLD)

        self.edit = AttrDict()
        self.edit.subscriberid = Entry.Static(
            self.form.table["subscriberid"],
            self,
            variable=self.form.getvar("subscriberid"))
        self.edit.name = Entry.Static(self.form.table["name"],
                                      self,
                                      variable=self.form.getvar("name"))
        self.edit.primarylocation = Entry.StaticReference(
            self.form.table["primarylocationid"],
            self,
            variable=self.form.getvar("primarylocationid"))

        for ctrl in self.edit.values():
            ctrl.SetForegroundColour(wx.Color(0, 0, 0))
            ctrl.SetFont(font18)
        self.edit.subscriberid.SetFont(font22b)

        self.row_1 = rcs.RowColSizer()
        self.row_1.Add(self.edit.subscriberid,
                       row=1,
                       col=1,
                       rowspan=2,
                       border=30,
                       flag=wx.EXPAND)
        self.row_1.Add(self.edit.name, row=1, col=2, flag=wx.EXPAND)
        self.row_1.Add(self.edit.primarylocation, row=2, col=2, flag=wx.EXPAND)

        self.sizer.Add(self.row_1, 10, flag=wx.EXPAND)

        ##Save option
        self.row_2 = wx.BoxSizer(wx.HORIZONTAL)
        #self.row_2.Add ( wx.StaticBitmap (self, bitmap=BITMAPS.WRITE) )

        self.row_2.AddStretchSpacer(5)

        txt = wx.StaticText(self, label="DANE ZOSTAŁY ZMIENIONE")
        #txt.Font = font18
        self.row_2.Add(txt, flag=wx.ALIGN_CENTER_VERTICAL)

        self.row_2.AddSpacer(40)

        btn = wx.BitmapButton(self, bitmap=BITMAPS.WRITE)
        btn.Bind(wx.EVT_BUTTON, self.doSave)
        self.row_2.Add(btn, flag=wx.ALIGN_CENTER_VERTICAL)

        self.row_2.AddSpacer(40)

        self.sizer.Add(self.row_2, 0, wx.EXPAND)

        self.SetSizer(self.sizer)
        self.sizer.Hide(self.row_2)
示例#8
0
    def __init__(self, parent, *args):
        from ProvCon.dbui.di import rSubscriber
        wx.Panel.__init__(self, parent, *args)

        self.form = AttrDict()
        self.table = AttrDict()
        self.editor = AttrDict()
        self.store = AttrDict()
        self.recordlist = AttrDict()
        self.dialogs = AttrDict()
        self.dialogs.service = ServiceDialog(self)
        self.dialogs.subscriber = NewSubscriberDialog(self)

        self.table.subscriber = meta.Table.Get("subscriber")
        self.table.service = meta.Table.Get("service")

        self.store.subscriber = APP.DataStore.subscriber
        self.store.services = orm.RecordList(
            self.table.service,
            select=["classofservice", "typeofservice", "handle"])

        self.form.subscriber = orm.Form(self.table.subscriber,
                                        recordclass=rSubscriber)
        subscriberRec = self.form.subscriber.current
        subscriberRec.enableChildren()

        self.mgr = wx.aui.AuiManager()
        self.mgr.SetManagedWindow(self)

        subscroll = ScrolledGenericForm(self.form.subscriber, self)
        self.editor.subscriber = subscroll.genericform

        self.info_panel = SubscriberInfoPanel(self, self.form.subscriber)
        self.command_panel = SubscriberCommandPanel(self, self.form.subscriber)

        def _format_service(r):
            return "<b>" + r.typeofservice_REF + "</b> " + r.classofservice_REF + "<br><i>" + r.locationid_REF + "</i>"

        def _format_ip(r):
            return "<b>" + r.address + "</b>"

        def _format_mac(r):
            fmt = "<tt><b>" + r.mac + "</b></tt>&nbsp;&nbsp; "
            if r.ipreservationid:
                fmt += " -&gt; <b>" + r.ipreservationid_REF + "</b>"
            return fmt

        def _format_device(r):
            return r._astxt

        #self.recordlist.services = rl.RecordList(self.store.services, self,
        #                                         reprfunc = _format_service)

        self.recordlist.services = rl.RecordList(
            subscriberRec.list_service_subscriberid,
            self,
            reprfunc=_format_service)
        self.recordlist.services.set_menu(
            ServiceListMenu(self, self.recordlist.services))

        self.recordlist.ip = rl.RecordList(subscriberRec.ipreservations,
                                           self,
                                           reprfunc=_format_ip)
        self.recordlist.ip.set_menu(IPListMenu(self, self.recordlist.ip))

        self.recordlist.mac = rl.RecordList(subscriberRec.macaddresses,
                                            self,
                                            reprfunc=_format_mac)
        self.recordlist.mac.set_menu(MACListMenu(self, self.recordlist.mac))

        self.recordlist.devices = rl.RecordList(subscriberRec.devices,
                                                self,
                                                reprfunc=_format_device)
        self.recordlist.devices.set_menu(
            DeviceListMenu(self, self.recordlist.devices))
        #self.recordlist.services.bind_to_form ( "subscriberid", self.form.subscriber)

        self.mgr.AddPane(
            self.info_panel,
            wx.aui.AuiPaneInfo().Top().Floatable(False).CloseButton(
                False).Caption("Podsumowanie danych klienta").Name(
                    "info_panel").Layer(1).MinSize((-1, 100)).BestSize(
                        (700, 170)))
        self.mgr.AddPane(
            SubscriberSearchToolbar(self),
            wx.aui.AuiPaneInfo().Bottom().CloseButton(True).Floatable(
                False).Dockable(False).Show().Name("search_results").Caption(
                    "Wyniki wyszukiwania...").Layer(1).MinSize((-1, 40)))

        self.mgr.AddPane(
            subscroll,
            wx.aui.AuiPaneInfo().CentrePane().Floatable(False).CloseButton(
                False).Name("subscriber_editor").Layer(0))

        self.mgr.AddPane(
            self.recordlist.services,
            wx.aui.AuiPaneInfo().Bottom().Floatable(False).CloseButton(False).
            Name("service_list").Layer(0).Row(1).Caption("Usługi").MinSize(
                (-1, 120)))
        self.mgr.AddPane(
            self.recordlist.devices,
            wx.aui.AuiPaneInfo().Bottom().Floatable(False).CloseButton(False).
            Name("device_list").Layer(0).Row(0).Caption("Urządzenia").MinSize(
                (-1, 160)))

        self.mgr.AddPane(
            self.command_panel,
            wx.aui.AuiPaneInfo().Left().Floatable(False).CloseButton(False).
            Name("command_panel").Caption("Toolbox").Layer(1).MinSize(
                (100, -1)))

        self.mgr.AddPane(
            self.recordlist.mac,
            wx.aui.AuiPaneInfo().Right().CloseButton(False).Floatable(False).
            Name("mac_address_list").Caption("MAC").Layer(1).MinSize(
                (300, -1)))

        self.mgr.AddPane(
            self.recordlist.ip,
            wx.aui.AuiPaneInfo().Right().CloseButton(False).Floatable(False).
            Name("ip_address_list").Caption("Adresy IP").Layer(1).MinSize(
                (300, -1)))

        self.mgr.Update()

        f = self.form.subscriber
        f.listenForEvent("request_record_change", self.subscriberRecordChange)
        f.listenForEvent("current_record_modified",
                         self.subscriberRecordModified)
        f.listenForEvent("current_record_deleted",
                         self.subscriberRecordDeleted)
        f.listenForEvent("current_record_saved", self.subscriberRecordSaved)
        f.listenForEvent("data_loaded", self.subscriberDataLoaded)