Exemple #1
0
 def __init__(self, scriptListCallBack, showLoginCallback,
              decryptScriptCallback, disposeCallback, connectCallback):
     from mainlogic import _
     self.scriptListCallBack = scriptListCallBack
     self.showLoginCallback = showLoginCallback
     self.decryptScriptCallback = decryptScriptCallback
     self.disposeCallback = disposeCallback
     self.connectCallback = connectCallback
     wx.Frame.__init__(self,
                       None,
                       title=_("Prosafe fixing script collection"),
                       size=wx.Size(750, 400))
     self.mainPanel = wx.Panel(self)
     self.scriptBook = wx.Notebook(self.mainPanel, style=wx.BK_DEFAULT)
     self.updatePages()
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     buttonSizer = wx.BoxSizer(wx.VERTICAL)
     sizer.Add(self.scriptBook, 4, wx.EXPAND)
     updatePagesButton = wx.Button(self.mainPanel, -1,
                                   _("Update script list"))
     updatePagesButton.Bind(wx.EVT_BUTTON, self.updatePages)
     buttonSizer.Add(updatePagesButton, 1, wx.ALL, 5)
     closeButton = wx.Button(self.mainPanel, -1, _("Return to login"))
     closeButton.Bind(wx.EVT_BUTTON, self.onCloseButton)
     buttonSizer.Add(closeButton, 1, wx.ALL, 5)
     sizer.Add(buttonSizer)
     self.mainPanel.SetSizer(sizer)
     self.shouldRestart = False
     self.Bind(wx.EVT_CLOSE, self.onCloseButton)
     self.disposeCallback()
    def __init__(self, parent, title='', formatsAndDescriptionsDict={}):
        from mainlogic import _
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          title=_("Formats"),
                          pos=wx.DefaultPosition,
                          size=wx.DefaultSize,
                          style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX
                          | wx.CLIP_CHILDREN,
                          name="browser")

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetBackgroundColour(wx.NullColor)

        self.BtnCopy = wx.Button(self, -1, _("copy"))
        self.BtnCopy.Bind(wx.EVT_BUTTON, self.onCopy)
        instructionLabel = wx.StaticText(self, -1,
                                         _("Formats usage instruction"))

        #self.sizer.AddStretchSpacer()
        self.listView = PSFormatListCtrl(
            parent=self, formatsAndDescriptionsDict=formatsAndDescriptionsDict)
        self.listView.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
        self.sizer.Add(instructionLabel, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        self.sizer.Add(self.listView, 1, wx.EXPAND | wx.ALL, 10)
        self.sizer.Add(self.BtnCopy, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        self.SetSizer(self.sizer)
        self.listView.Fit()
Exemple #3
0
    def __init__(self, parent, mainLogic):
        from mainlogic import _
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.AddSpacer(30)

        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)
        translationMode = mainLogic.translationMode
        label = wx.StaticText(self, -1, _("Translation mode"))
        box.Add(label, 1, wx.ALIGN_RIGHT)

        box.AddSpacer(5)

        optionList = [_("Activated"), _("Deactivated")]
        self.radioBox = wx.RadioBox(self, -1, _("Activation options"),
                                    wx.DefaultPosition, wx.DefaultSize,
                                    optionList, 1, wx.RA_SPECIFY_COLS)
        if translationMode:
            self.radioBox.SetSelection(0)
        else:
            self.radioBox.SetSelection(1)

        box.Add(self.radioBox, 2, wx.EXPAND)
        box.AddSpacer(10)

        sizer.Add(box, 0, wx.EXPAND)
        sizer.AddSpacer(10)

        #final setup
        self.SetSizer(sizer)
Exemple #4
0
 def onDataModifiedForbidden(self,notifyingObject,userInfo=None):
     from mainlogic import _
     dlg = wx.MessageDialog(None, 
         _("Cannot modify data in Status 4 or 5."),
         _("ERROR"), wx.OK | wx.ICON_EXCLAMATION)
     result = dlg.ShowModal()
     dlg.Destroy()
 def onOldLetter(self, event):
     from mainlogic import _
     dlg = wx.MessageDialog(None, _("Create letter advice"), _("Warning"),
                            wx.YES_NO | wx.ICON_QUESTION)
     dlg.Center()
     result = dlg.ShowModal()
     if result == wx.ID_YES:
         self.oldLetterCallback()
Exemple #6
0
    def __init__(self, parent):
        from mainlogic import _
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.AddSpacer(30)

        #OLD password
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)
        label = wx.StaticText(self, -1, _("Old Password"))
        box.Add(label, 1, wx.EXPAND)
        box.AddSpacer(5)
        self.opassword = wx.TextCtrl(self,
                                     -1,
                                     "",
                                     size=(80, -1),
                                     style=wx.TE_PASSWORD)
        box.Add(self.opassword, 2, wx.EXPAND)
        box.AddSpacer(10)
        sizer.Add(box, 0, wx.EXPAND)

        #new password
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)
        label = wx.StaticText(self, -1, _("New password"))
        box.Add(label, 1, wx.EXPAND)
        box.AddSpacer(5)
        self.npassword = wx.TextCtrl(self,
                                     -1,
                                     "",
                                     size=(80, -1),
                                     style=wx.TE_PASSWORD,
                                     validator=PasswordOrEmptyValidator())
        box.Add(self.npassword, 2, wx.EXPAND)
        box.AddSpacer(10)
        sizer.Add(box, 0, wx.EXPAND)

        #new password again
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)
        label = wx.StaticText(self, -1, _("Confirm password"))
        box.Add(label, 1, wx.EXPAND)
        box.AddSpacer(5)
        self.rnpassword = wx.TextCtrl(self,
                                      -1,
                                      "",
                                      size=(80, -1),
                                      style=wx.TE_PASSWORD,
                                      validator=PasswordAgainValidator(
                                          self.npassword))
        box.Add(self.rnpassword, 2, wx.EXPAND)
        box.AddSpacer(10)
        sizer.Add(box, 0, wx.EXPAND)
        sizer.AddSpacer(30)

        #final setup
        self.SetSizer(sizer)
        self.Fit()
Exemple #7
0
    def refreshData(self, data, admissionsToEvaluate=None):
        from mainlogic import _
        if admissionsToEvaluate:
            admissionsToEvaluate = set(admissionsToEvaluate)
        self.itemDataMap = self.buildDataMap(data)
        self.DeleteAllItems()
        rindex = 0
        #for item in data:
        #    for i, key in enumerate(psc.gridColumnList):
        #        columnName = psc.gridColumnDict[key]
        #        if key == 'admissionKey':
        #            self.InsertStringItem(rindex, item[key])
        #            continue
        #        if item[key] != None:
        #            value = item[key]
        #            if key in psc.gridColumnTypes and psc.gridColumnTypes[key] == 'datetime':
        #                value = self.dateToPretty(value)
        #            self.SetStringItem(rindex, i, unicode(value))
        #TODO MERGE: in psconstants, implement using generic psc.gridColumnTypes
        for item in data:
            actualAdmissionKey = self.reformatAdmissionKey(
                item['admissionKey'])
            self.actualAdmissionKeysToAdmissionKeys[actualAdmissionKey] = item[
                'admissionKey']
            litem = self.InsertStringItem(rindex, actualAdmissionKey)
            colour = (255, 255, 255)
            if rindex % 2 == 0:
                colour = (206, 218, 255)
            self.SetItemBackgroundColour(litem, colour)
            cindex = 1
            textData = psc.rowDataToText(item)
            for key in self.gridColumns:
                value = textData[key]
                if not value and key != 'petalsComplete':
                    if self.shouldAnonymizeData:
                        value = '--------'
                    else:
                        value = ""

                if key == 'petalsComplete':
                    if value == True:
                        value = _("Yes")
                    elif value == False:
                        value = _("No")
                    else:
                        value = ""
                if key == 'statusValue' and admissionsToEvaluate and textData[
                        'admissionKey'] in admissionsToEvaluate:
                    value = "%s (%s)" % (value, _("updating"))

                if key in psc.gridColumnAttributes and value and self.shouldAnonymizeData:
                    value = '--------'
                self.SetStringItem(rindex, cindex, unicode(value))
                cindex += 1
            self.SetItemData(rindex, rindex)
            rindex += 1
Exemple #8
0
    def __init__(self, pageOne=None):
        wx.Frame.__init__(self, None, style=wx.BORDER | wx.STAY_ON_TOP)
        self.pageOne = pageOne
        #self.edit = editor.Editor(self, -1,  size=(130,65), style=wx.SUNKEN_BORDER | wx.VSCROLL )
        self.edit = wx.TextCtrl(self,
                                -1,
                                size=(200, 100),
                                style=wx.TE_MULTILINE | wx.TE_PROCESS_ENTER)

        from mainlogic import _
        Hbsizer = wx.BoxSizer(wx.VERTICAL)
        Hbsizer.Add(self.edit, 1, wx.EXPAND)
        #self.bt_copi = wx.Button(self, -1, label=_('Copy'), pos=(100,160), size=(75,23))
        #self.bt_copi.Bind(wx.EVT_BUTTON, self.clic_copi)

        #self.bt_cut = wx.Button(self, -1, label=_('Cut'), pos=(190,160), size=(75,23))
        #self.bt_cut.Bind(wx.EVT_BUTTON, self.clik_cup)

        #self.bt_past = wx.Button(self, -1, label=_('Paste'), pos=(280,160), size=(75,23))
        #self.bt_past.Bind(wx.EVT_BUTTON, self.clik_past)
        self.bt_undo = wx.Button(self,
                                 -1,
                                 label=_('Cancel'),
                                 pos=(100, 160),
                                 size=(75, 23))
        self.bt_undo.Bind(wx.EVT_BUTTON, self.cancelText)

        self.bt_clear = wx.Button(self,
                                  -1,
                                  label=_('Clear'),
                                  pos=(190, 160),
                                  size=(75, 23))
        self.bt_clear.Bind(wx.EVT_BUTTON, self.clearText)

        self.bt_save = wx.Button(self,
                                 -1,
                                 label=_('OK'),
                                 pos=(370, 160),
                                 size=(75, 23),
                                 name=self.pageOne.procedureName)
        self.bt_save.Bind(wx.EVT_BUTTON, self.savetext)

        Vbsizer = wx.BoxSizer(wx.HORIZONTAL)
        #Vbsizer.Add(self.bt_copi, wx.EXPAND)
        #Vbsizer.Add(self.bt_cut, wx.EXPAND)
        #Vbsizer.Add(self.bt_past, wx.EXPAND)
        Vbsizer.Add(self.bt_clear, wx.EXPAND)
        Vbsizer.Add(self.bt_undo, wx.EXPAND)
        Vbsizer.Add(self.bt_save, wx.EXPAND)

        Hbsizer.Add(Vbsizer, 0, wx.EXPAND)
        self.SetSizer(Hbsizer)
        self.SetAutoLayout(1)
        Hbsizer.Fit(self)
        self.MakeModal()
        self.Show(1)
Exemple #9
0
 def onFixerExplanationButton(self, event):
     from mainlogic import _
     fixerExplanationMessage = _(
         "Checking this button allows (ONLY) the admin user to access the fixing scripts collection."
     )
     title = _("Some explanation about fixer access.")
     dlg = GMD.GenericMessageDialog(self, fixerExplanationMessage, title,
                                    wx.OK | wx.ICON_INFORMATION)
     dlg.ShowModal()
     dlg.Destroy()
Exemple #10
0
 def updateConsolePanelText(self):
     from mainlogic import _
     errorsAndWarnings = self.errorsCallback()
     numberOfErrors = errorsAndWarnings['errors']
     numberOfUnacceptedWarnings = errorsAndWarnings['warnings']
     errorsText = _("Errors") + " (%d)" % numberOfErrors
     warningsText = _("Warnings") + " (%d)" % numberOfUnacceptedWarnings
     self.consolePanel.SetPageText(0,errorsText)
     self.consolePanel.SetPageText(1,warningsText)
     self.SetStatusText("  %s   %s" % (errorsText,warningsText))
Exemple #11
0
    def __init__(self, parent, id,callback=None,customizableFields=None, customizedFields=None, proceduresPersonalizations=None,removalOptions=None):
        
        wx.Treebook.__init__(self, parent, id, style=wx.BK_DEFAULT)
        idGenerator=self.getNextID(50)
        self.callback=callback
        #self.callback_treatmnt=callback_treatmnt
        self.cal={}
        self.cal_treatmnt={}
        self.cal_cancel={}
        self.cal_preliev={}

        #Composition list element for each page in funtion TreeB_element
        #initilization listCrt in each pages
        self.init_lstCrt={}
        self.dic_custm={}
        self.dic_custm_val={}
        self.lischk=[]
        #self.liscan=[]
        self.dico_cs_lab={}
        self.dico_prova={}

        self.dico_prova=self.datbase_elemt(customizedFields)
                    
        # return dico_data_tre,dic_pag_nam,dico_db_data
        TreeB_element,self.dico_cs_lab,self.dico_DB_val=self.getPageList(customizableFields, customizedFields, proceduresPersonalizations,removalOptions)
       
        for el in self.dico_cs_lab:
            for k in self.dico_cs_lab[el]:
                self.init_lstCrt[k]=''
        self.dic_custm=copy.copy(self.dico_DB_val)
        
        #creat the the tree with the pages 
        for k,v in TreeB_element.items():
            from mainlogic import _
            # Parent page
            # win=self.make_Tree_Panel(k,'papa')
            if k=='core':
                win=self.make_Tree_Panel(k,'papa')
                self.AddPage(win,'%s                                              '%_(k).upper(),imageId=idGenerator.next())
                #creat the tree son child branch and pages
            
                #Solo la personalizzazine del CODE
                if v!=[]:
                    for sub in v:
                        for cle,elm in sub.items():
                            if cle !='':
                                if cle in self.dico_DB_val.keys():
                                    win=self.make_Tree_Panel(cle,'sottopagina',elm,self.dico_DB_val)
                                else:
                                    win=self.make_Tree_Panel(cle,'sottopagina',elm)
                                   
                                self.AddSubPage(win,_(cle),imageId=idGenerator.next())
        self.GetTreeCtrl().ExpandAll()    
            # This is a workaround for a sizing bug on Mac
        wx.FutureCall(100, self.AdjustSize)
Exemple #12
0
    def __init__(self,
                 parent,
                 question,
                 title='Prosafe Dialog',
                 mode=1,
                 callback=None,
                 size=wx.Size(-1, 150)):
        """
        mode explanation:
        mode = 1 for yes / no dialog
        mode = 2 for yes / no / cancel dialog
        """

        from mainlogic import _
        wx.Dialog.__init__(self,
                           parent,
                           id=-1,
                           title=title,
                           pos=wx.DefaultPosition,
                           size=size,
                           style=wx.DEFAULT_DIALOG_STYLE | wx.CENTER,
                           name="genericPsDialog")
        imageFile = os.path.join(psc.imagesPath, "question.png")
        bmp = wx.Image(imageFile, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        sbitmap = wx.StaticBitmap(self, -1, bmp)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.returnValue = None
        label = wx.StaticText(self, -1, question)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(sbitmap, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        hbox.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        sizer.Add(hbox, 10, wx.EXPAND)

        box = wx.BoxSizer(wx.HORIZONTAL)
        btn = wx.Button(self, wx.ID_YES, _("Yes"))
        btnn = wx.Button(self, ID_CANCEL, _("No"))
        btn.SetDefault()

        box.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL)
        box.Add(btnn, 0, wx.ALIGN_CENTRE | wx.ALL)
        if mode == 2:
            btnc = wx.Button(self, ID_NOTHING, _("Cancel"))
            box.Add(btnc, 0, wx.ALIGN_CENTRE | wx.ALL)
            self.Bind(wx.EVT_BUTTON, self.doNothing, id=ID_NOTHING)

        self.Bind(wx.EVT_BUTTON, self.doClose, id=ID_CANCEL)
        self.Bind(wx.EVT_BUTTON, self.doAction, id=wx.ID_YES)
        line = wx.StaticLine(self, -1, size=(20, -1), style=wx.LI_HORIZONTAL)
        sizer.Add(line, 0,
                  wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
        sizer.Add(box, 0, wx.ALIGN_CENTRE)
        sizer.AddSpacer(10)

        self.SetSizer(sizer)
        self.Layout()
Exemple #13
0
    def __init__(self, parent, id, privateKey):
        from mainlogic import _
        wx.Dialog.__init__(self,
                           parent,
                           id=-1,
                           pos=wx.DefaultPosition,
                           size=wx.DefaultSize,
                           style=wx.CAPTION | wx.CENTER,
                           title=_('Please read carefully'),
                           name='keydialog')

        self.privateKey = privateKey

        disclaimerMessage = _('PRIVATE_KEY_MESSAGE') % privateKey
        sizer = wx.BoxSizer(wx.VERTICAL)
        vsizer = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1,
                              _("Please read carefully").upper() + "\n")
        label.SetFont(wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD, True,
                              'Tahoma'))
        vsizer.Add(label, 0, wx.ALIGN_CENTRE | wx.ALL)
        vsizer.AddSpacer(20)

        box = wx.BoxSizer(wx.HORIZONTAL)
        msgLabel = wx.StaticText(self, -1, disclaimerMessage)
        box.Add(msgLabel, 0, wx.ALIGN_LEFT | wx.RIGHT, 10)
        vsizer.Add(box, 0, wx.ALIGN_LEFT | wx.BOTTOM, 5)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        btn = wx.Button(self, wx.ID_OK)
        btn.SetDefault()
        btn.Bind(wx.EVT_BUTTON, self.doExit)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        btn = wx.Button(self, -1, _("save"))
        btn.Bind(wx.EVT_BUTTON, self.doSave)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        btn = wx.Button(self, -1, _("Print"))
        btn.Bind(wx.EVT_BUTTON, self.doPrint)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        vsizer.AddSpacer(25)
        vsizer.Add(btnSizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        vsizer.AddSpacer(10)

        sizer.Add(vsizer, 0, wx.ALL, 10)

        self.SetSizer(sizer)
        self.Fit()

        self.exitFlag = False
Exemple #14
0
    def __init__(self, parent, id, privateKeyCallback, setPrivateKeyCallback):
        from mainlogic import _
        wx.Dialog.__init__(self,
                           parent,
                           id=-1,
                           pos=wx.DefaultPosition,
                           size=wx.DefaultSize,
                           style=wx.CAPTION | wx.CENTER,
                           title=_('Private key'),
                           name='setkeydialog')

        self.privateKeyCallback = privateKeyCallback
        self.setPrivateKeyCallback = setPrivateKeyCallback

        privateKey = self.privateKeyCallback()
        sizer = wx.BoxSizer(wx.VERTICAL)

        sizer.AddSpacer(25)

        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)
        label = wx.StaticText(self, -1, _("Private key:"))
        box.Add(label, 1, wx.EXPAND)
        self.keyText = wx.TextCtrl(self,
                                   -1,
                                   privateKey,
                                   size=(300, -1),
                                   validator=NotEmptyValidator())
        box.Add(self.keyText, 2)
        box.AddSpacer(10)
        sizer.Add(box, 1, wx.EXPAND)

        btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        btn = wx.Button(self, -1, _("save"))
        btn.Bind(wx.EVT_BUTTON, self.doSet)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        btn = wx.Button(self, -1, _("Reset"))
        btn.Bind(wx.EVT_BUTTON, self.doReset)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        btn = wx.Button(self, -1, _("Close"))
        btn.SetDefault()
        btn.Bind(wx.EVT_BUTTON, self.doExit)
        btnSizer.Add(btn, 0, wx.ALIGN_CENTRE | wx.ALL, 5)

        sizer.AddSpacer(25)
        sizer.Add(btnSizer, 0, wx.ALIGN_CENTRE | wx.ALL, 5)
        sizer.AddSpacer(10)

        self.SetSizer(sizer)
        self.Fit()
Exemple #15
0
 def OnFileExit(self, evt):
     from mainlogic import _
     if self.modified:
         dlg = wx.MessageDialog(
             None,
             _("Do you really want to quit? All unsaved changes will be lost"
               ), _("Confirm quit"), wx.OK | wx.CANCEL | wx.ICON_QUESTION)
         dlg.Center()
         result = dlg.ShowModal()
         if result != wx.ID_OK:
             return
     self.Close(True)
Exemple #16
0
    def __init__(self, parent, mainLogic, showPageCallback, data):
        wx.Panel.__init__(self, parent, -1)

        self.parent = parent

        self.SetBackgroundColour(BACKGROUND_COLOUR)

        self.mainLogic = mainLogic

        self.showPageCallback = showPageCallback

        sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(sizer)

        innerSizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(innerSizer, 0, wx.ALL, 10)

        hsizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(hsizer, 0, wx.ALL | wx.ALIGN_RIGHT, 20)

        from mainlogic import _

        okButton = wx.Button(self, wx.ID_OK)
        openAdmissionButton = wx.Button(self, -1, _("Open patient"))
        openNextAdmissionButton = wx.Button(self, wx.ID_OK, _("Open Next"))
        cancelButton = wx.Button(self, wx.ID_CANCEL)

        self.Bind(wx.EVT_BUTTON, self.onOk, id=wx.ID_OK)
        openAdmissionButton.Bind(wx.EVT_BUTTON, self.onOpenAdmission)
        openNextAdmissionButton.Bind(wx.EVT_BUTTON, self.onOpenNextAdmission)

        self.shouldOpenAdmission = False
        self.shouldOpenNextAdmission = False

        hsizer.Add(okButton, 0, wx.BOTTOM, 20)
        hsizer.AddSpacer(10)
        hsizer.Add(openAdmissionButton, 0, wx.BOTTOM, 20)
        hsizer.AddSpacer(10)
        hsizer.Add(openNextAdmissionButton, 0, wx.BOTTOM, 20)
        hsizer.AddSpacer(10)
        hsizer.Add(cancelButton, 0, wx.BOTTOM, 20)

        self.guiGenerator = GuiGenerator(self, innerSizer, self.mainLogic,
                                         self.showPageCallback)

        self.mainLogic.notificationCenter.addObserver(
            self, self.onDataUpdated, "DataHasBeenUpdated",
            self.mainLogic.dataSession)
        self.mainLogic.notificationCenter.addObserver(
            self, self.onDataNotUpdated, "DataCannotBeUpdated",
            self.mainLogic.dataSession)

        self.Layout()
Exemple #17
0
    def MakePaneContent(self, pane):

        from mainlogic import _
        sizer = wx.BoxSizer(wx.VERTICAL)

        vsizer = wx.BoxSizer(wx.HORIZONTAL)
        vsizer.AddSpacer(5)
        sizer.AddSpacer(5)

        numberOfFilters = len(psc.filterList)

        sizerLeft = wx.BoxSizer(wx.VERTICAL)

        for key in psc.filterList[:numberOfFilters / 2]:
            ctrl = PSFilterControl(pane,
                                   attribute=psc.basedataAttributeDict[key],
                                   label=psc.filterDict[key])
            sizerLeft.Add(ctrl, 0, wx.GROW)

        vsizer.Add(sizerLeft)
        vsizer.AddSpacer(15)

        sizerRight = wx.BoxSizer(wx.VERTICAL)

        for key in psc.filterList[numberOfFilters / 2:]:
            ctrl = PSFilterControl(pane,
                                   attribute=psc.basedataAttributeDict[key],
                                   label=psc.filterDict[key])
            sizerRight.Add(ctrl, 0, wx.GROW)

        vsizer.Add(sizerRight)

        sizer.Add(vsizer, 0)
        sizer.AddSpacer(10)

        self.btnSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.applyBtn = wx.Button(pane, -1, _("Apply filter"))
        self.btnSizer.Add(self.applyBtn, 0, wx.ALIGN_CENTRE)

        self.removeBtn = wx.Button(pane, -1, _("Remove filter"))
        self.btnSizer.Add(self.removeBtn, 0, wx.ALIGN_CENTRE)
        self.btnSizer.Hide(self.removeBtn)

        sizer.Add(self.btnSizer, 0, wx.ALIGN_CENTRE)
        sizer.AddSpacer(5)

        self.Bind(wx.EVT_BUTTON, self.doApplyFilter, self.applyBtn)
        self.Bind(wx.EVT_BUTTON, self.doRemoveFilter, self.removeBtn)

        pane.SetSizer(sizer)
        sizer.Layout()
        self.sizer = sizer
Exemple #18
0
 def OnUndoReset(self, evt):
     from mainlogic import _
     dlg = wx.MessageDialog(
         None,
         _("Do you really want to revert the document to your previous version?"
           ), _("Confirm reset"), wx.OK | wx.CANCEL | wx.ICON_QUESTION)
     dlg.Center()
     result = dlg.ShowModal()
     if result != wx.ID_OK:
         return
     self.undoResetCallback()
     self.LoadFile()
     self.Modified(False)
Exemple #19
0
 def onErrorsAndWarningsFound(self,notifyingObject,userInfo):
     from mainlogic import _
     anyErrors = userInfo['errors']
     anyUnacceptedWarnings = userInfo['warnings']
     if anyErrors and anyUnacceptedWarnings:
         self.SetStatusText(_("There are errors and unaccepted warnings. Please review and correct."))
         self.showErrorsInConsolePanel()
     elif anyErrors:
         self.SetStatusText(_("There are errors. Please review and correct."))
         self.showErrorsInConsolePanel()
     elif anyUnacceptedWarnings:
         self.SetStatusText(_("There are unaccepted warnings. Please review, correct or accept."))
         self.showWarningsInConsolePanel()
Exemple #20
0
    def buildInputControls(self, sizer):

        #sizer.Clear(True)
        
        from mainlogic import _
        if self.actualOpValue == _('is filled') or self.actualOpValue ==  _('is not filled'):

            if self.attrDataType == 'string':
                if self.stringInput:
                    self.stringInput.Hide()

            elif self.attrDataType == 'datetime':
                if self.dateInput1:
                    self.dateInput1.Hide()
                if self.dateInput2:
                    self.andLabel.Hide()
                    self.dateInput2.Hide()

        else:

            if self.attrDataType == 'string':

                if not self.stringInput:
                    self.stringInput = wx.TextCtrl(self, -1, "", size=wx.DefaultSize)
                    sizer.Add(self.stringInput, 1, wx.EXPAND)
                self.stringInput.Show()

            elif self.attrDataType == 'datetime':

                if not self.dateInput1:
                    self.dateInput1 = CalendarTextbox(self, -1, wx.DateTime(), 'dd/mm/yyyy')
                    sizer.Add(self.dateInput1, 1, wx.EXPAND)
                self.dateInput1.Show()
                
                if self.opCb.GetValue()== _("between"):           
                    if not self.dateInput2:
                        sizer.AddSpacer(5)
                        self.andLabel = wx.StaticText(self, -1, _("and"), size=wx.Size(25, -1))
                        sizer.Add(self.andLabel, 0)
                        sizer.AddSpacer(5)
                        self.dateInput2 = CalendarTextbox(self, -1, wx.DateTime(), 'dd/mm/yyyy')
                        sizer.Add(self.dateInput2, 1, wx.EXPAND)      
                    self.andLabel.Show()
                    self.dateInput2.Show()

                else:
                    if self.dateInput2:
                        self.andLabel.Hide()
                        self.dateInput2.Hide()
        
        sizer.Layout()
Exemple #21
0
 def OnReset(self, evt):
     from mainlogic import _
     dlg = wx.MessageDialog(
         None,
         _("Do you really want to reset the document and discard your edits?"
           ), _("Confirm reset"), wx.OK | wx.CANCEL | wx.ICON_QUESTION)
     dlg.Center()
     result = dlg.ShowModal()
     if result != wx.ID_OK:
         return
     self.ortc.SaveFile(self.filename, rt.RICHTEXT_TYPE_XML)
     self.resetCallback()
     self.LoadFile()
     self.Modified(False)
Exemple #22
0
 def doSaveClientConfig(self, event):
     from mainlogic import _
     if self.radioBox.GetStringSelection() == _("GCP compilation enabled"):
         self.mainLogic.gcpActive = True
     elif self.radioBox.GetStringSelection() == _("GCP compilation disabled"):
         self.mainLogic.gcpActive = False
     self.mainLogic.setGcpSetting(self.mainLogic.gcpActive)
     dlg = wx.MessageDialog(None, 
         _("GCP settings saved correctly!"),
         _("GCP settings saved correctly!"), wx.OK | wx.ICON_EXCLAMATION)
     dlg.Center()
     dlg.ShowModal()
     dlg.Destroy()
     self.Destroy()
Exemple #23
0
 def uploadDB(self, event):
     result = self.uploadDBCallback()
     if result == True:
         dlg = wx.MessageDialog(self,
                                _("Data has been successfully uploaded."),
                                _("Success"), wx.OK)
         dlg.Center()
         dlg.ShowModal()
     else:
         dlg = wx.MessageDialog(
             self, _("Data upload failed, check network connection."),
             _("ERROR"), wx.OK | wx.ICON_ERROR)
         dlg.Center()
         dlg.ShowModal()
Exemple #24
0
    def __init__(self, parent, mainLogic):
       
        from mainlogic import _
        wx.Dialog.__init__(self, parent, id=-1, title=_("GCP Configuration"), pos=wx.DefaultPosition,size=wx.Size(500,400), style=   wx.DEFAULT_DIALOG_STYLE,
            name="usermanager") 
        
        #recupero lista utenti
        self.mainLogic = mainLogic
         
        sizer = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.VERTICAL)
        
        label = wx.StaticText(self, -1, _("GCP_INSTRUCTION"), size=wx.Size(400, -1))
        disclaimerLabel = wx.StaticText(self, -1, _("GCP_WARNING"), size=wx.Size(400, -1))
        font = wx.Font(11, wx.SWISS, wx.NORMAL, wx.BOLD)
        disclaimerLabel.SetFont(font)
        disclaimerLabel.SetForegroundColour(wx.RED)
        label.Wrap(label.GetSize().width) 
        disclaimerLabel.Wrap(disclaimerLabel.GetSize().width) 
        
        hbox.Add(label, 1, wx.EXPAND|wx.ALL, border=10)
        hbox.Add(disclaimerLabel, 1, wx.EXPAND|wx.ALL, border=10)
        
        disclaimerLabel.Show(False)
        optionList = [_("GCP compilation enabled"), _("GCP compilation disabled")]
        self.radioBox =  wx.RadioBox(self, -1, _("Activation options"), wx.DefaultPosition, wx.DefaultSize, optionList, 1, wx.RA_SPECIFY_COLS)
        #self.Bind(wx.EVT_RADIOBOX, self.onRadioBoxCheckChanged, radioBox)
        hbox.Add(self.radioBox, 1, wx.EXPAND|wx.ALL, border=10)

        
        sizer.Add(hbox, 1, wx.EXPAND)
        self.radioBox.SetSelection(0)
        if not self.mainLogic.gcpActive:
            self.radioBox.SetSelection(1)
        #buttons    
        box = wx.BoxSizer(wx.HORIZONTAL)         
        btn = wx.Button(self, ID_SAVE, _("Save"))
        
        #event binding
        self.Bind(wx.EVT_BUTTON, self.doSaveClientConfig, id=ID_SAVE)
        
        #add to sizer
        box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL)

        btnc = wx.Button(self, ID_CANCEL, _("Cancel"))
        btn.SetDefault()
        #event binding
        self.Bind(wx.EVT_BUTTON, self.doClose, id=ID_CANCEL)
        
        #add to sizer
        box.Add(btnc, 0, wx.ALIGN_CENTRE|wx.ALL)
        sizer.Add(box, 0, wx.ALIGN_CENTRE)

        
        self.SetSizer(sizer)
        
        if self.mainLogic.forceGcp:
            btn.Enable(False)
            self.radioBox.Enable(False)
            disclaimerLabel.Show(True)
Exemple #25
0
 def doTest(self, event):
     address = self.address.GetValue()
     address = address.replace('http://', '')
     username = self.username.GetValue()
     password = self.password.GetValue()
     busyCursor = wx.BusyCursor()
     connected = self.testConnectionCallback(address, username, password)
     del busyCursor
     from mainlogic import _
     #TODO: TRANSLATE
     if connected:
         self.messageText.SetLabel(_("Connection successful"))
     else:
         self.messageText.SetLabel(_("Connection failed"))
     self.Layout()
Exemple #26
0
 def OnAddImage(self, evt):
     self.Modified()
     from mainlogic import _
     imageFileName = wx.FileSelector(
         _("Choose image file"),
         wildcard=
         "PNG files (*.png)|*.png|BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif|JPEG Files (*.jpeg)|*.jpeg|JPG Files (*.jpg)|*.jpg",
         default_extension='png',
         flags=wx.FD_OPEN)
     if not imageFileName:
         return
     position = self.rtc.GetInsertionPoint()
     previousTags = 0
     for entry in self.tagList:
         if entry['rtrange'][0] < position:
             previousTags += 1
             continue
     shift = 0
     for i in range(previousTags):
         entry = self.tagList[i]
         shift += (entry['rtrange'][1] - entry['rtrange'][0]) - (
             entry['range'][1] - entry['range'][0])
     oposition = position - shift
     self.ortc.SetInsertionPoint(oposition)
     style = rt.TextAttrEx()
     self.rtc.GetStyle(position, style)
     self.ortc.WriteImageFile(imageFileName, wx.BITMAP_TYPE_ANY)
     self.ortc.SetStyleEx((oposition - 1, oposition), style)
     self.RenderText()
Exemple #27
0
    def closureOfInstancesProperties(self, graph, progressBar=None) :
        result = rdflib.Graph()
        result += graph
        
        dic_file = {
        1:'eq-sym',
        2:'eq-trans',
        3:'prp-eqp1',
        4:'prp-eqp2',
        5:'eq-rep-o',
        6:'scm-eqc1',
        7:'scm-eqc2',
        8:'cls-hv2',
        10:'cax-eqc1',
        11:'cax-eqc2',
        12:'cls-hv1'}
        
        from mainlogic import _
        for el in sorted(dic_file.keys()):
            progressBar.Step(stepValue=(1.0 / 11.0), message = _('executing rules:') + ' %s' % dic_file[el], isRule=True)
            tempGraph = self.executeRule(dic_file[el], result)
            result += tempGraph
        
        for ns in graph.namespaces() :
            result.bind(ns[0], ns[1])

        return result
Exemple #28
0
    def __init__(self, parent, mainLogic):
        from mainlogic import _
        wx.Panel.__init__(self, parent, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.AddSpacer(30)

        box = wx.BoxSizer(wx.HORIZONTAL)
        box.AddSpacer(10)

        label = wx.StaticText(self, -1, _("Language"))
        box.Add(label, 1, wx.ALIGN_RIGHT)

        box.AddSpacer(5)

        langList = mainLogic.getLanguageNames()

        currentLang = mainLogic.userLanguage

        self.lang = wx.ComboBox(self,
                                500,
                                currentLang,
                                choices=langList,
                                style=wx.CB_DROPDOWN | wx.CB_READONLY)
        box.Add(self.lang, 2, wx.EXPAND)
        box.AddSpacer(10)

        sizer.Add(box, 0, wx.EXPAND)
        sizer.AddSpacer(10)

        #final setup
        self.SetSizer(sizer)
Exemple #29
0
    def __init__(self, parent, importDataFromPackageCallback):
        from mainlogic import _
        #wx.Dialog.__init__(self, parent, id=-1, title='Activation', pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CAPTION | wx.CENTER | wx.STAY_ON_TOP, name="activationframe")
        wx.Dialog.__init__(self, parent, id=-1, title=_("Data import"), pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CAPTION | wx.CENTER, name="activationframe")
 
        self.importDataFromPackageCallback = importDataFromPackageCallback
        self.imageFile =  os.path.join(psc.imagesPath, "logologin.png")
        bmp = wx.Image(self.imageFile,wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        sbitmap = wx.StaticBitmap(self, -1, bmp)
        self.dataImportCompleted = False
        outerSizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(outerSizer)
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sbitmap, 0, wx.ALIGN_CENTRE|wx.ALL)
        outerSizer.Add(sizer,0,wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT,border=20)

        font = wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
        font.SetWeight(wx.FONTWEIGHT_BOLD)

        label = wx.StaticText(self, -1, _("PROSAFE - Master data import"))
        label.SetFont(font)
        sizer.AddSpacer(10)
        sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL)
        sizer.AddSpacer(20)
        label = wx.StaticText(self, -1, _("Please select the masterdata.zip file to restore data from the old PROSAFE master"))
        label.Wrap(350)
        sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL)
        sizer.AddSpacer(20)

        gridSizer = wx.FlexGridSizer(2,2)
        sizer.Add(gridSizer, 0, wx.ALIGN_CENTRE|wx.ALL)
        self.btn = filebrowse.FileBrowseButton(self, -1, size=(450, -1), changeCallback = self.getPathFromFileBrowseButton, fileMask = '*.pmd')
        btnOut = wx.Button(self, ID_OUT, _("Exit"))
        btnImport = wx.Button(self, ID_IMPORT, _("Start data import"))
        
        self.Bind(wx.EVT_BUTTON, self.onDestroy, id=ID_OUT)
        self.Bind(wx.EVT_BUTTON, self.onStartImport, id=ID_IMPORT)

        sizer.AddSpacer(5)
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(self.btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        box.Add(btnOut, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        box.Add(btnImport, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        sizer.Add(box, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
        sizer.AddSpacer(10)
        self.path = ''
        self.Fit()
Exemple #30
0
    def __init__(self, parent, centreCode, openAdmissionCallback,
                 shouldAnonymizeData):

        wx.ListView.__init__(self,
                             parent,
                             id=-1,
                             style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES
                             | wx.LC_SINGLE_SEL)

        #TODO: mess in appconfig.py about grid column stuff
        self.shouldAnonymizeData = shouldAnonymizeData
        from mainlogic import _
        columns = []
        columns.append(_("Admission code"))
        for label in psc.gridColumnLabels:
            columns.append(_(label))
        columns.append(_("Core status"))
        columns.append(_("Petals complete"))

        CustColumnSorterMixin.__init__(self, len(columns))

        self.centreCode = centreCode

        self.sortColumn = 0
        self.sortAscending = 1

        self.openAdmissionCallback = openAdmissionCallback

        self.itemDataMap = dict()

        self.actualAdmissionKeysToAdmissionKeys = dict()

        from mainlogic import _

        #for i, key in enumerate(psc.gridColumnList):
        for i, key in enumerate(columns):
            #columnName = psc.gridColumnDict[key]
            columnName = key
            self.InsertColumn(i, _(columnName), format=wx.LIST_FORMAT_CENTRE)

        #bind double click event
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.openAdmission)
        list = self.GetListCtrl()
        self.Bind(wx.EVT_LIST_COL_CLICK, self.OnColClick, list)

        self.gridColumns = psc.gridColumnAttributes + ('statusValue',
                                                       'petalsComplete')