Exemple #1
0
    def __init__(self, label, name=wxpg.LABEL_AS_NAME, value={"x": 0, "y": 0}):
        wxpg.PyProperty.__init__(self, label, name)

        self.AddPrivateChild(wxpg.IntProperty("X", value=value["x"]))
        self.AddPrivateChild(wxpg.IntProperty("Y", value=value["y"]))

        self.m_value = value
    def __init__(self, label, name=wxpg.PG_LABEL, value=wx.Size(0, 0)):
        wxpg.PGProperty.__init__(self, label, name)

        value = self._ConvertValue(value)

        self.AddPrivateChild(wxpg.IntProperty("X", value=value.x))
        self.AddPrivateChild(wxpg.IntProperty("Y", value=value.y))

        self.m_value = value
Exemple #3
0
 def __init__(self, label, name=wxpg.LABEL_AS_NAME, value=wx.Rect()):
     super(RectProperty, self).__init__(label, name)
     self.SetValue(value)
     self.AddPrivateChild(
         wxpg.IntProperty(_("X"), wxpg.LABEL_AS_NAME, value.x))
     self.AddPrivateChild(
         wxpg.IntProperty(_("Y"), wxpg.LABEL_AS_NAME, value.y))
     self.AddPrivateChild(
         wxpg.IntProperty(_("Width"), wxpg.LABEL_AS_NAME, value.width))
     self.AddPrivateChild(
         wxpg.IntProperty(_("Height"), wxpg.LABEL_AS_NAME, value.height))
Exemple #4
0
    def Remplissage(self):
        # --------------------------- COULEURS DE FOND ------------------------------------------
        self.Append( wxpg.PropertyCategory(_(u"Couleurs de fond")) )

        # Couleur 3
        propriete = wxpg.ColourProperty(label=_(u"Fond ligne entêtes"), name="couleur_fond_entetes", value=wx.Colour(204, 204, 255))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur 1
        propriete = wxpg.ColourProperty(label=_(u"Fond ligne dépôt"), name="couleur_fond_depot", value=wx.Colour(230, 230, 255))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur 2
        propriete = wxpg.ColourProperty(label=_(u"Fond ligne total"), name="couleur_fond_total", value=wx.Colour(204, 204, 255))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- TEXTE ------------------------------------------
        self.Append( wxpg.PropertyCategory(_(u"Texte")) )

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte"), name="taille_texte", value=7)
        propriete.SetHelpString(_(u"Saisissez une taille de texte (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte", "SpinCtrl")

        # --------------------------- COLONNES ------------------------------------------
        self.Append( wxpg.PropertyCategory(_(u"Colonnes")) )

        # Largeur colonne labels
        propriete = wxpg.IntProperty(label=_(u"Largeur colonne label"), name="largeur_colonne_labels", value=170)
        propriete.SetHelpString(_(u"Saisissez la largeur pour la colonne label (170 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_labels", "SpinCtrl")

        # Largeur colonne valeurs
        propriete = wxpg.IntProperty(label=_(u"Largeur colonne valeur"), name="largeur_colonne_valeurs", value=45)
        propriete.SetHelpString(_(u"Saisissez la largeur pour la colonne valeur (45 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_valeurs", "SpinCtrl")
    def _create_dummy_content(self):
        # some dummy content from the wxPython demo
        import wx.propgrid as wxpg
        pg = self.widget
        pg.AddPage( "Page 1 - Dummy" )

        pg.Append( wxpg.PropertyCategory("1 - Basic Properties") )
        pg.Append( wxpg.StringProperty("String",value="Some Text") )

        sp = pg.Append( wxpg.StringProperty('StringProperty w/ Password flag', value='ABadPassword') )
        sp.SetAttribute('Hint', 'This is a hint')
        sp.SetAttribute('Password', True)

        pg.Append( wxpg.IntProperty("Int",value=123) )
        pg.Append( wxpg.FloatProperty("Float",value=123.4) )
        pg.Append( wxpg.BoolProperty("Bool",value=True) )
        pg.Append( wxpg.BoolProperty("Bool_with_Checkbox",value=True) )
        pg.SetPropertyAttribute( "Bool_with_Checkbox", "UseCheckbox", True)
        pg.Append( wxpg.PropertyCategory("2 - More Properties") )
        pg.Append( wxpg.LongStringProperty("LongString", value="This is a\nmulti-line string\nwith\ttabs\nmixed\tin."))
        pg.Append( wxpg.DirProperty("Dir",value=r"C:\Windows") )
        pg.Append( wxpg.FileProperty("File",value=r"C:\Windows\system.ini") )
        pg.Append( wxpg.ArrayStringProperty("ArrayString",value=['A','B','C']) )

        pg.Append( wxpg.EnumProperty("Enum","Enum", ['wxPython Rules', 'wxPython Rocks', 'wxPython Is The Best'],
                                                    [10,11,12], 0) )
        pg.Append( wxpg.EditEnumProperty("EditEnum","EditEnumProperty", ['A','B','C'], [0,1,2], "Text Not in List") )

        pg.Append( wxpg.PropertyCategory("3 - Advanced Properties") )
        pg.Append( wxpg.DateProperty("Date",value=wx.DateTime.Now()) )
        pg.Append( wxpg.FontProperty("Font",value=self.widget.GetFont()) )
        pg.Append( wxpg.ColourProperty("Colour", value=self.widget.GetBackgroundColour()) )
        pg.Append( wxpg.SystemColourProperty("SystemColour") )
        pg.Append( wxpg.ImageFileProperty("ImageFile") )
        pg.Append( wxpg.MultiChoiceProperty("MultiChoice", choices=['wxWidgets','QT','GTK+']) )

        pg.Append( wxpg.PropertyCategory("4 - Additional Properties") )
        pg.Append( wxpg.IntProperty("IntWithSpin",value=256) )
        pg.SetPropertyEditor("IntWithSpin","SpinCtrl")

        pg.SetPropertyAttribute( "File", wxpg.PG_FILE_SHOW_FULL_PATH, 0 )
        pg.SetPropertyAttribute( "File", wxpg.PG_FILE_INITIAL_PATH, r"C:\Program Files\Internet Explorer" )
        if compat.IS_PHOENIX:
            pg.SetPropertyAttribute( "Date", wxpg.PG_DATE_PICKER_STYLE, wx.adv.DP_DROPDOWN|wx.adv.DP_SHOWCENTURY )

        pg.AddPage( "Page 2 - Almost Empty" )
        pg.Append( wxpg.PropertyCategory("1 - Basic Properties") )
        pg.Append( wxpg.StringProperty("String 2",value="Some Text") )
    def __init__(self, parent, listeDonnees=[]):
        wxpg.PropertyGrid.__init__(self,
                                   parent,
                                   -1,
                                   style=wxpg.PG_SPLITTER_AUTO_CENTER)
        self.listeDonnees = listeDonnees

        # Définition des éditeurs personnalisés
        if not getattr(sys, '_PropGridEditorsRegistered', False):
            self.RegisterEditor(EditeurAvecBoutons)
            # ensure we only do it once
            sys._PropGridEditorsRegistered = True

        # Remplissage des valeurs
        for nom, listeProprietes in self.listeDonnees:
            self.Append(wxpg.PropertyCategory(nom))

            for dictTemp in listeProprietes:
                propriete = wxpg.IntProperty(label=dictTemp["label"],
                                             name=dictTemp["code"],
                                             value=dictTemp["valeur"])
                self.Append(propriete)
                self.SetPropertyAttribute(propriete, "Min", 0)
                self.SetPropertyAttribute(propriete, "Max", 800)
                self.SetPropertyEditor(propriete, "EditeurAvecBoutons")
Exemple #7
0
    def add_int_property(self, name, key, value, status=None, enabled=True, *args, **kwargs):
        """
        Add integer property.

        :param name:
        :param key:
        :param value:
        :param status: status bar string
        :param enabled:
        :param args:
        :param kwargs:
        :return:
        """
        item = propgrid.IntProperty(name, key, value=value)
        self.Append(item)

        if status:
            self.SetPropertyHelpString(key, status)

        if enabled:
            self.EnableProperty(key)
        else:
            self.DisableProperty(key)

        return item
Exemple #8
0
    def getPropertyForType(self, stg, pid, dt):
        if dt == "str":
            pgp = wxpg.StringProperty(pid, value="")

        elif dt == "float":
            pgp = wxpg.FloatProperty(pid, value=0.0)

        elif dt in ["int", "extruder"]:
            pgp = wxpg.IntProperty(pid, value=0)

        elif dt == "bool":
            pgp = wxpg.BoolProperty(pid, value=False)

        elif dt == "enum":
            opts = [str(x) for x in stg.getOptions()]
            pgp = wxpg.EnumProperty(pid,
                                    labels=opts,
                                    values=range(len(opts)),
                                    value=0)

        else:
            self.log("taking default action for unknown data type: %s" % dt)
            pgp = wxpg.StringProperty(pid, value="")

        return pgp
Exemple #9
0
    def addProp(self, oid):
        attr = self.dialog.attribs[oid]
        value = attr.GetValue()
        if oid == self.dialog.rdnOid:
            icon = "attribRDN"
        elif oid in self.dialog.mustAttribs:
            icon = "attribMust"
        else:
            icon = "attribMay"

        if attr.IsBinary():
            property = wxpg.StringProperty(attr.name, "",
                                           xlt("<binary data; can't edit>"))
        elif attr.IsSingleValue():
            if attr.IsInteger():
                property = wxpg.IntProperty(attr.name, oid, value)
            else:
                if not value:
                    value = ""
                property = wxpg.StringProperty(attr.name, oid, value)
        else:
            if not value:
                value = []
            property = wxpg.ArrayStringProperty(attr.name, oid, value)
        self.grid.Append(property)
        self.grid.SetPropertyImage(property, self.dialog.GetBitmap(icon))

        if not attr.IsBinary():
            attr.items[self.grid] = property
        return property
Exemple #10
0
    def AddProperty(self, property, parent_property=None):
        self.inAddProperty += 1

        # add a cad.property, optionally to an existing wx.PGProperty
        if property.GetType() == cad.PROPERTY_TYPE_STRING:
            new_prop = wxpg.StringProperty(property.GetTitle(),
                                           value=property.GetString())
        elif property.GetType() == cad.PROPERTY_TYPE_LONG_STRING:
            #new_prop = wxpg.LongStringProperty("MultipleButtons", wxpg.PG_LABEL)
            new_prop = wxpg.StringProperty(property.GetTitle(),
                                           value=property.GetString())
        elif property.GetType() == cad.PROPERTY_TYPE_DOUBLE:
            new_prop = wxpg.FloatProperty(property.GetTitle(),
                                          value=property.GetDouble())
        elif property.GetType() == cad.PROPERTY_TYPE_LENGTH:
            new_prop = wxpg.FloatProperty(property.GetTitle(),
                                          value=property.GetDouble() /
                                          cad.GetUnits())
        elif property.GetType() == cad.PROPERTY_TYPE_INT:
            new_prop = wxpg.IntProperty(property.GetTitle(),
                                        value=property.GetInt())
        elif property.GetType() == cad.PROPERTY_TYPE_COLOR:
            col = property.GetColor()
            wcol = wx.Colour(col.red, col.green, col.blue)
            new_prop = wxpg.ColourProperty(property.GetTitle(), value=wcol)
        elif property.GetType() == cad.PROPERTY_TYPE_CHOICE:
            new_prop = wxpg.EnumProperty(property.GetTitle(),
                                         labels=property.GetChoices(),
                                         value=property.GetInt())
        elif property.GetType() == cad.PROPERTY_TYPE_CHECK:
            new_prop = wxpg.BoolProperty(property.GetTitle(),
                                         value=property.GetBool())
            new_prop.SetAttribute(wxpg.PG_BOOL_USE_CHECKBOX, True)
        elif property.GetType() == cad.PROPERTY_TYPE_LIST:
            new_prop = wxpg.StringProperty(property.GetTitle(),
                                           value='<composed>')
        elif property.GetType() == cad.PROPERTY_TYPE_FILE:
            new_prop = wxpg.FileProperty(property.GetTitle(),
                                         value=property.GetString())
        else:
            wx.MessageBox('invalid property type: ' + str(property.GetType()))
            return

        if not property.editable:
            new_prop.ChangeFlag(wxpg.PG_PROP_READONLY, True)
        self.Append(parent_property, new_prop, property)

        if property.GetType() == cad.PROPERTY_TYPE_LIST:
            plist = property.GetProperties()
            for p in plist:
                self.AddProperty(p, new_prop)
            new_prop.ChangeFlag(wxpg.PG_PROP_COLLAPSED, True)
        elif property.GetType() == cad.PROPERTY_TYPE_LONG_STRING:
            # Change property to use editor created in the previous code segment
            #self.pg.SetPropertyEditor("MultipleButtons", self.multiButtonEditor)
            self.pg.SetPropertyEditor(new_prop, "TrivialPropertyEditor")

        self.inAddProperty -= 1
Exemple #11
0
    def _init_db_stats(self):
        self.propgrid.Append(wxpg.PropertyCategory("Database statistics",
                                                   "db"))

        prop = wxpg.IntProperty("Number of items", "db.items", 0)
        self.propgrid.Append(prop)
        prop.Enable(False)

        self.refresh_database_statistics()
Exemple #12
0
    def __init__(self, label, name=wxpg.LABEL_AS_NAME, value=0):
        wxpg.PyProperty.__init__(self, label, name)

        a, r, g, b = value >> 24, value >> 16 & 0xFF, value >> 8 & 0xFF, value & 0xFF
        self.AddPrivateChild(
            wxpg.ColourProperty("RGB", value=wx.Colour(r, g, b)))
        self.AddPrivateChild(wxpg.IntProperty("Alpha", value=a))

        self.m_value = value
    def Remplissage(self):
        # Heure min affichée
        propriete = wxpg.StringProperty(label=_(u"Heure minimale affichée"),
                                        name="heure_min",
                                        value="08:30")
        propriete.SetHelpString(_(u"Saisissez une heure"))
        propriete.SetEditor("EditeurHeure")
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Heure max affichée
        propriete = wxpg.StringProperty(label=_(u"Heure maximale affichée"),
                                        name="heure_max",
                                        value="22:30")
        propriete.SetHelpString(_(u"Saisissez une heure"))
        propriete.SetEditor("EditeurHeure")
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Intervalle souris
        propriete = wxpg.StringProperty(label=_(u"Pas de la souris"),
                                        name="temps_arrondi",
                                        value="00:30")
        propriete.SetHelpString(_(u"Saisissez un temps"))
        propriete.SetEditor("EditeurHeure")
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Durée minimale barre
        propriete = wxpg.StringProperty(label=_(u"Durée minimale location"),
                                        name="barre_duree_minimale",
                                        value="00:30")
        propriete.SetHelpString(_(u"Saisissez une durée"))
        propriete.SetEditor("EditeurHeure")
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Hauteur de ligne
        propriete = wxpg.IntProperty(label=_(u"Hauteur de ligne"),
                                     name="case_hauteur",
                                     value=50)
        propriete.SetHelpString(
            _(u"Saisissez une hauteur de ligne (50 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("case_hauteur", "SpinCtrl")

        # Autoriser changement de ligne
        propriete = wxpg.BoolProperty(
            label=_(u"Autoriser le changement de ligne"),
            name="autoriser_changement_ligne",
            value=True)
        propriete.SetHelpString(
            _(u"Cochez cette case si vous souhaitez pouvoir changer de ligne"))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)
Exemple #14
0
    def __init__(self,
                 label,
                 name=wxpg.LABEL_AS_NAME,
                 value=[1024, 0, 0, 1024, 0, 0]):
        wxpg.PyProperty.__init__(self, label, name)

        for i in xrange(6):
            self.AddPrivateChild(wxpg.IntProperty(str(i + 1), value=value[i]))

        self.m_value = value
Exemple #15
0
    def _handle_load_options(self, kwargs):
        filename = kwargs['filename']

        if filename in organism_alarms_api.get_supported_open_databases():
            alimit = organism_alarms_api.get_alarms_log_limit(filename)
            prop = wxpg.IntProperty(
                "Alarms log soft limit",
                "options.extension.organism_alarms.alimit", alimit)
            prop.SetEditor("SpinCtrl")
            wxgui_api.add_property_option(
                filename, prop, self.alarmlogs[filename].set_log_limit)
Exemple #16
0
    def __init__(self, parent):
        wx.Dialog.__init__(self,
                           parent,
                           -1,
                           'NLExtract BAG config aanpassen',
                           size=(400, 200))

        self.panel = panel = wx.Panel(self, wx.ID_ANY)

        # Difference between using PropertyGridManager vs PropertyGrid is that
        # the manager supports multiple pages and a description box.
        self.pg = pg = wxpg.PropertyGridManager(
            panel, style=wxpg.PG_SPLITTER_AUTO_CENTER | wxpg.PG_AUTO_SORT)
        pg.AddPage("BAG Extract Config")

        pg.Append(wxpg.PropertyCategory("BAG Extract Config"))
        pg.Append(
            wxpg.StringProperty("Database naam",
                                value="%s" % BAGConfig.config.database))
        pg.Append(
            wxpg.StringProperty("Database schema",
                                value="%s" % BAGConfig.config.schema))
        pg.Append(
            wxpg.StringProperty("Database host",
                                value="%s" % BAGConfig.config.host))
        pg.Append(
            wxpg.StringProperty("Database user",
                                value="%s" % BAGConfig.config.user))
        pg.Append(
            wxpg.StringProperty("Database password",
                                value="%s" % BAGConfig.config.password))
        pg.Append(
            wxpg.IntProperty("Database poort",
                             value=int(BAGConfig.config.port)))
        # pg.Append(wxpg.BoolProperty("Verbose logging", value=True))
        # pg.SetPropertyAttribute("Bool_with_Checkbox", "UseCheckbox", True)

        topsizer = wx.BoxSizer(wx.VERTICAL)
        topsizer.Add(pg, 1, wx.EXPAND)
        but = wx.Button(panel, -1, "Bewaren")
        but.Bind(wx.EVT_BUTTON, self.OnSave)
        topsizer.Add(but, 1, wx.EXPAND)

        # rowsizer = wx.BoxSizer(wx.HORIZONTAL)
        # rowsizer.Add(but, 1)

        panel.SetSizer(topsizer)
        topsizer.SetSizeHints(panel)

        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(panel, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
Exemple #17
0
    def Remplissage(self):
        # Plateforme
        self.Append(wxpg.PropertyCategory(_(u"Paramètres")))

        liste_choix = [
            ("contact_everyone", _(u"Contact Everyone By Orange Business")),
            ("cleversms", _(u"Clever SMS")),
            ("clevermultimedias", _(u"Clever Multimedias")),
            ]

        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Plateforme"), name="plateforme", liste_choix=liste_choix, valeur=None)
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(_(u"Sélectionnez une plateforme"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Adresse envoi d'email
        DB = GestionDB.DB()
        req = """SELECT IDadresse, adresse FROM adresses_mail ORDER BY adresse; """
        DB.ExecuterReq(req)
        liste_adresses = DB.ResultatReq()
        DB.Close()
        liste_adresses.insert(0, (0, _(u"Aucune")))
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Adresse d'expédition d'email"), name="adresse_expedition_email", liste_choix=liste_adresses, valeur=0)
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(_(u"Sélectionnez l'adresse d'expédition de l'email. Cette adresse doit être référencée sur votre compte Contact Everyone."))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Adresse de destination
        propriete = wxpg.StringProperty(label=_(u"Adresse de destination"), name="orange_adresse_destination_email", value="*****@*****.**")
        propriete.SetHelpString(_(u"Saisissez l'adresse de destination de l'email"))
        self.Append(propriete)

        # Adresse de destination
        propriete = wxpg.StringProperty(label=_(u"Adresse de destination"), name="cleversms_adresse_destination_email", value="*****@*****.**")
        propriete.SetHelpString(_(u"Saisissez l'adresse de destination de l'email"))
        self.Append(propriete)

        # Adresse de destination
        propriete = wxpg.StringProperty(label=_(u"Adresse de destination"), name="clevermultimedias_adresse_destination_email", value="*****@*****.**")
        propriete.SetHelpString(_(u"Saisissez l'adresse de destination de l'email"))
        self.Append(propriete)

        # Nbre caractères max
        propriete = wxpg.IntProperty(label=_(u"Nombre maximal de caractères du message"), name="nbre_caracteres_max", value=160)
        propriete.SetHelpString(_(u"Nombre maximal de caractères du message"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("nbre_caracteres_max", "SpinCtrl")
Exemple #18
0
    def _init_options(self):
        self.propgrid.Append(
            wxpg.PropertyCategory("Miscellaneous options", "options"))

        hlimit = core_api.get_database_history_soft_limit(self.filename)

        prop = wxpg.IntProperty("Items log soft limit", "options.core.hlimit",
                                hlimit)

        self.onchange_actions["options.core.hlimit"] = self._set_history_limit

        prop.SetEditor("SpinCtrl")
        prop.SetAttribute("Min", 0)
        prop.SetAttribute("Max", 999)
        self.propgrid.Append(prop)

        load_options_event.signal(filename=self.filename)
Exemple #19
0
    def initialize_fixed_properties(self, pg):
        pg.Append(wxpg.PropertyCategory(_("1 - Range specification")))
        pg.Append(wxpg.StringProperty(self.SLIDE_RANGE))
        pg.Append(wxpg.StringProperty(self.REPEAT_RANGE))

        pg.Append(wxpg.PropertyCategory(_("2 - Text to find and replace")))
        pg.Append(wxpg.StringProperty(self.FIND_TEXT))
        pg.Append(wxpg.LongStringProperty(self.REPLACE_TEXT))
        pg.Append(wxpg.LongStringProperty(self.PREPROCESS_SCRIPT))

        pg.Append(wxpg.PropertyCategory(_("3 - Archive processing")))
        pg.Append(wxpg.BoolProperty(self.ARCHIVE_LYRIC_FILES))
        pg.Append(wxpg.StringProperty(self.OPTION_SPLIT_LINE_AT_EVERY))

        pg.Append(wxpg.PropertyCategory(_("4 - Word wrap archive text")))
        pg.Append(wxpg.BoolProperty(self.ENABLE_WORDWRAP))
        pg.Append(wxpg.FontProperty(self.WORDWRAP_FONT))
        pg.Append(wxpg.IntProperty(self.PAGE_WITDH))
Exemple #20
0
    def set_solver(self, solver):
        """Sets current solver and builds UI basing on its properties.

        :param Solver solver: Solver to show properties of.
        """

        # Set the solver
        self.solver = solver

        # Reset the properties
        self.reset()

        # Skip if there is no solver or solver has no properties
        if not self.solver or not self.solver.properties:
            return

        # For each property
        for i, p in enumerate(self.solver.properties):
            # Create property object with appropriate type
            if p.type is int:
                prop = wxpg.IntProperty()
            elif p.type is float:
                prop = wxpg.FloatProperty()
            elif issubclass(p.type, Enum):
                prop = wxpg.EnumProperty()
                labels = list(map(lambda c: c.name, p.type))
                values = list(map(lambda c: c.value, p.type))
                prop_choices = wxpg.PGChoices(labels=labels, values=values)
                prop.SetChoices(prop_choices)

            # Set label and value
            prop.SetLabel(p.name)
            prop.SetValue(p.default)
            prop.SetDefaultValue(p.default)
            prop.SetAttribute('property_idx', i)

            # And append the property object
            self.Append(prop)

        # Fit columns and layout the parent
        self.FitColumns()
        self.GetParent().Layout()
Exemple #21
0
    def fill_property_grid(self):
        print('Filling property grid')
        pair = self.wxprop_layerconf_pair
        pg = self.property_grid_1
        lc = self.layer_config
        pg.Append(wxpg.PropertyCategory("1 - Basic Properties"))
        if len(lc.keys()):
            for p in lc.keys():
                # print('    property <<%s>>'%p)
                proper = lc[p]   # Конфигурационный объект потомок CommonProp
                value = lc[p]()
                curprop = None
                # p - parametr name
                # value - default value of parametr
                if isinstance(proper, layers_opt.BoolProp):  # дискретный параметр
                    curprop = pg.Append(wxpg.BoolProperty(p, value=value))  # объект wx

                elif isinstance(proper, layers_opt.RealRangeProp):  # вещественный параметр
                    curprop = pg.Append(wxpg.FloatProperty(p, value=value))

                elif isinstance(proper, layers_opt.IntRangeProp):  # целочисленый параметр
                    curprop = pg.Append(wxpg.IntProperty(p, value=value))

                elif isinstance(proper, layers_opt.SelectOneProp): # выбор один из многих
                    choices = wxpg.PGChoices()
                    for choice in proper:
                        choices.Add(label=choice, value=wxpg.PG_INVALID_VALUE)
                    default_coice = choices.GetIndicesForStrings([value,])[0]
                    # print(default_coice)
                    curprop = pg.Append(wxpg.EnumProperty(label=p, name=p, choices=choices))
                    curprop.SetChoiceSelection(default_coice)

                if curprop is not None:
                    curprop.SetHelpString(proper.__doc__)
                    pair[curprop] = proper  # свойство wx, свойство CommonProp
        else: # no properties
            print(' No properties')
            empty_prop = pg.Append(wxpg.StringProperty(label='No editable property', value='May be for a while'))
            empty_prop.SetHelpString('Nothing to tweek here')
            pg.Enable(False)
        print('End of filling property grid')
    def init_view(self, items, para, preview=False, modal=True, app=None):
        self.para, self.modal = para, modal
        self.pg = pg = wxpg.PropertyGridManager(
            self, style=wxpg.PG_SPLITTER_AUTO_CENTER)

        sizer = wx.BoxSizer(wx.VERTICAL)
        # Show help as tooltips
        pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS)
        pg.Bind(wxpg.EVT_PG_CHANGED, self.OnPropGridChange)
        pg.Bind(wxpg.EVT_PG_SELECTED, self.OnPropGridSelect)

        pg.AddPage('')
        for i in items:
            if i[0] == 'lab': pg.Append(wxpg.PropertyCategory(i[2]))
            if i[0] == int:
                pg.Append(wxpg.IntProperty(i[1], value=int(para[i[1]]) or 0))
            if i[0] == float:
                pg.Append(
                    wxpg.FloatProperty(i[1], value=float(para[i[1]]) or 0))
            if i[0] == str:
                pg.Append(wxpg.StringProperty(i[1], value=para[i[1]] or ''))
            if i[0] == 'txt':
                pg.Append(wxpg.LongStringProperty(i[1], value=para[i[1]]
                                                  or ''))
            if i[0] == bool: pg.Append(wxpg.BoolProperty(i[1]))
            if i[0] == 'date':
                pg.Append(wxpg.DateProperty(i[1], value=wx.DateTime.Now()))
            #if i[0] == 'list': pg.Append( wxpg.EnumProperty(i[1], i[1], [i.strip() for i in i[2][1:-1].split(',')]))
            #if i[0] == 'img': pg.Append( wxpg.EnumProperty(v[1], v[1], ['a','b','c']))
            #if i[0] == 'tab': pg.Append( wxpg.EnumProperty(v[1], v[1], ['a','b','c']))

        #if preview:self.add_ctrl_(Check, 'preview', ('preview',), app=app)
        #self.reset(para)
        sizer.Add(pg, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.add_confirm(modal)
        self.Layout()
        self.Fit()
        wx.Dialog.Bind(self, wx.EVT_WINDOW_DESTROY, self.OnDestroy)
        #wx.Dialog.Bind(self, wx.EVT_IDLE, lambda e: self.reset())
        print('bind close')
Exemple #23
0
 def refereshView(self):
     #referesh the grid based on self.confList
     confdir=(_("Configuration File Location"),[(("confDir"),{"desc":_("Configuration Directory"),
         "value":os.path.dirname(self.confPath),"type":"directory"})])
     self.confList.insert(0,confdir)
     for cgroup in self.confList:
         self.grid.Append(wxpg.PropertyCategory(cgroup[0]))
         for conf in cgroup[1]:
             if conf[1]['type']=='directory':
                 self.grid.Append(wxpg.DirProperty(conf[1]['desc'],conf[0],conf[1]['value']))
                 continue
             if conf[1]['type']=='string':
                 self.grid.Append(wxpg.StringProperty(conf[1]['desc'],conf[0],conf[1]['value']))
                 continue
             if conf[1]['type']=='int':
                 self.grid.Append(wxpg.IntProperty(conf[1]['desc'],conf[0],conf[1]['value']))
                 continue
             if conf[1]['type']=='float':
                 self.grid.Append(wxpg.FloatProperty(conf[1]['desc'],conf[0],conf[1]['value']))
                 continue
             if conf[1]['type']=='bool':
                 self.grid.Append(wxpg.BoolProperty(conf[1]['desc'],conf[0],conf[1]['value']))
                 continue
     self.grid.CenterSplitter(False)
Exemple #24
0
    def __init__(self, *args, **kwds):
        # begin wxGlade: MainPannel.__init__
        #kwds["style"] = wx.TAB_TRAVERSAL|wx.BORDER_DEFAULT|wx.CLOSE_BOX
        wx.Dialog.__init__(self, *args, **kwds)
        self.grid = wxpg.PropertyGrid(self, wx.ID_ANY)
        self.grid.Append(
            wxpg.IntProperty(_("Password Length"), "plen", value=16))
        self.grid.Append(
            wxpg.BoolProperty(_("Use lowercause letters"),
                              "lowercase",
                              value=True))
        self.grid.SetPropertyAttribute("lowercase", "UseCheckbox", True)
        self.grid.Append(
            wxpg.BoolProperty(_("Use Uppercase letters"),
                              "uppercase",
                              value=True))
        self.grid.SetPropertyAttribute("uppercase", "UseCheckbox", True)
        self.grid.Append(
            wxpg.BoolProperty(_("Use digits"), "digit", value=True))
        self.grid.SetPropertyAttribute("digit", "UseCheckbox", True)
        self.grid.Append(
            wxpg.BoolProperty(_("Use punctions"), "punction", value=True))
        self.grid.SetPropertyAttribute("punction", "UseCheckbox", True)
        self.grid.Append(
            wxpg.StringProperty(_("Use custom letters"), "custom", value=""))

        self.passwd = u""

        self.__set_properties()
        self.__do_layout()

        okb = self.bsizer.GetAffirmativeButton()
        canb = self.bsizer.GetCancelButton()
        self.Bind(wx.EVT_BUTTON, self.OnOK, okb)
        self.Bind(wx.EVT_BUTTON, self.OnCancel, canb)
        self.Centre()
Exemple #25
0
 def test_propgridprops04(self):
     p = pg.IntProperty()
    def Remplissage(self):
        # --------------------------- TYPE DE DOCUMENT------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Type de document")))

        # Type
        propriete = wxpg.EnumProperty(
            label=_(u"Type"),
            name="type_document",
            labels=[_(u"Détaillé"),
                    _(u"Simplifié"), (u"Totaux")],
            values=[0, 1, 2],
            value=0)
        propriete.SetHelpString(_(u"Sélectionnez un type de document"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- COULEURS DE FOND ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Couleurs de fond")))

        # Couleur 1
        propriete = wxpg.ColourProperty(label=_(u"Couleur de fond 1"),
                                        name="couleur_fond_1",
                                        value=wx.Colour(204, 204, 255))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur 2
        propriete = wxpg.ColourProperty(label=_(u"Couleur de fond 2"),
                                        name="couleur_fond_2",
                                        value=wx.Colour(230, 230, 255))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- TITRE ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Titre")))

        # Texte
        propriete = wxpg.StringProperty(
            label=_(u"Texte"),
            name="titre_texte",
            value=_(u"Récapitulatif des factures"))
        propriete.SetHelpString(_(u"Saisissez un texte"))
        self.Append(propriete)

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte"),
                                     name="titre_taille_texte",
                                     value=16)
        propriete.SetHelpString(
            _(u"Saisissez une taille de texte (16 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("titre_taille_texte", "SpinCtrl")

        # Couleur
        ##        propriete = wxpg.ColourProperty(label=_(u"Couleur de texte"), name="titre_couleur", value=wx.BLACK)
        ##        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        ##        propriete.SetAttribute("obligatoire", True)
        ##        self.Append(propriete)

        # Alignement
        labels = [_(u"Gauche"), _(u"Centre"), _(u"Droite")]
        propriete = wxpg.EnumProperty(
            label=_(u"Alignement du texte"),
            name="titre_alignement",
            labels=labels,
            values=[wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_RIGHT],
            value=wx.ALIGN_LEFT)
        propriete.SetHelpString(_(u"Sélectionnez le type d'alignement"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- FAMILLES ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Champs familiaux")))

        liste_choix = [
            ("non", _(u"Non")),
        ]
        for dictQuestion in self.GetGrandParent(
        ).Questionnaires.listeQuestions:
            liste_choix.append(("{QUESTION_%d}" % dictQuestion["IDquestion"],
                                dictQuestion["label"]))

        # Question 1
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 1"),
                                                      name="question_1",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un item du questionnaire famille à inclure dans le document"
              ))
        self.Append(propriete)

        # Question 2
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 2"),
                                                      name="question_2",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un item du questionnaire famille à inclure dans le document"
              ))
        self.Append(propriete)

        # Question 3
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 3"),
                                                      name="question_3",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un item du questionnaire famille à inclure dans le document"
              ))
        self.Append(propriete)

        # --------------------------- INDIVIDUS ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Champs individuels")))

        liste_choix = [
            ("non", _(u"Non")),
            ("ecole_debut_facture",
             _(u"Ecole à la date de début de la facture")),
            ("ecole_fin_facture", _(u"Ecole à la date de fin de la facture")),
            ("classe_debut_facture",
             _(u"Classe à la date de début de la facture")),
            ("classe_fin_facture",
             _(u"Classe à la date de fin de la facture")),
            ("niveau_debut_facture",
             _(u"Niveau scolaire à la date de début de la facture")),
            ("niveau_fin_facture",
             _(u"Niveau scolaire à la date de fin de la facture")),
        ]

        # Champ individuel 1
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 1"),
                                                      name="champ_ind_1",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un champ individuel à intégrer dans le document"
              ))
        self.Append(propriete)

        # Champ individuel 2
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 2"),
                                                      name="champ_ind_2",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un champ individuel à intégrer dans le document"
              ))
        self.Append(propriete)

        # Champ individuel 3
        propriete = CTRL_Propertygrid.Propriete_choix(label=_(u"Champ 3"),
                                                      name="champ_ind_3",
                                                      liste_choix=liste_choix,
                                                      valeur="non")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(
            _(u"Sélectionnez un champ individuel à intégrer dans le document"
              ))
        self.Append(propriete)

        # --------------------------- INTRODUCTION ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Introduction")))

        # Texte
        propriete = wxpg.StringProperty(label=_(u"Texte"),
                                        name="intro_texte",
                                        value=u"")
        propriete.SetHelpString(_(u"Saisissez un texte"))
        self.Append(propriete)

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte"),
                                     name="intro_taille_texte",
                                     value=7)
        propriete.SetHelpString(
            _(u"Saisissez une taille de texte (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("intro_taille_texte", "SpinCtrl")

        # Style
        ##        labels = [_(u"Normal"), _(u"Light"), "Gras"]
        ##        valeurs = [wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT, wx.FONTWEIGHT_BOLD]
        ##        propriete = wxpg.EnumProperty(label=_(u"Style de texte"), name="intro_style", labels=labels, values=valeurs, value=wx.FONTWEIGHT_NORMAL)
        ##        propriete.SetHelpString(_(u"Sélectionnez un style de texte"))
        ##        propriete.SetAttribute("obligatoire", True)
        ##        self.Append(propriete)

        # Couleur
        ##        propriete = wxpg.ColourProperty(label=_(u"Couleur de texte"), name="intro_couleur", value=wx.BLACK)
        ##        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        ##        propriete.SetAttribute("obligatoire", True)
        ##        self.Append(propriete)

        # Alignement
        labels = [_(u"Gauche"), _(u"Centre"), _(u"Droite")]
        propriete = wxpg.EnumProperty(
            label=_(u"Alignement du texte"),
            name="intro_alignement",
            labels=labels,
            values=[wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_RIGHT],
            value=wx.ALIGN_LEFT)
        propriete.SetHelpString(_(u"Sélectionnez le type d'alignement"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- CONCLUSION ------------------------------------------
        self.Append(wxpg.PropertyCategory(_(u"Conclusion")))

        # Texte
        propriete = wxpg.StringProperty(
            label=_(u"Texte"),
            name="conclusion_texte",
            value=_(
                u"{NBRE_FACTURES} factures | Montant total : {TOTAL_FACTURES}")
        )
        propriete.SetHelpString(
            _(u"Saisissez un texte. Vous pouvez utiliser les mots-clés suivants : {NBRE_FACTURES}, {TOTAL_FACTURES}, {NBRE_FACT_PRELEV}, {TOTAL_FACT_PRELEV}"
              ))
        self.Append(propriete)

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte"),
                                     name="conclusion_taille_texte",
                                     value=7)
        propriete.SetHelpString(
            _(u"Saisissez une taille de texte (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("conclusion_taille_texte", "SpinCtrl")

        # Style
        ##        labels = [_(u"Normal"), _(u"Light"), "Gras"]
        ##        valeurs = [wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT, wx.FONTWEIGHT_BOLD]
        ##        propriete = wxpg.EnumProperty(label=_(u"Style de texte"), name="conclusion_style", labels=labels, values=valeurs, value=wx.FONTWEIGHT_BOLD)
        ##        propriete.SetHelpString(_(u"Sélectionnez un style de texte"))
        ##        propriete.SetAttribute("obligatoire", True)
        ##        self.Append(propriete)

        # Couleur
        ##        propriete = wxpg.ColourProperty(label=_(u"Couleur de texte"), name="conclusion_couleur", value=wx.BLACK)
        ##        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        ##        propriete.SetAttribute("obligatoire", True)
        ##        self.Append(propriete)

        # Alignement
        labels = [_(u"Gauche"), _(u"Centre"), _(u"Droite")]
        propriete = wxpg.EnumProperty(
            label=_(u"Alignement du texte"),
            name="conclusion_alignement",
            labels=labels,
            values=[wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_RIGHT],
            value=wx.ALIGN_LEFT)
        propriete.SetHelpString(_(u"Sélectionnez le type d'alignement"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
    def Remplissage(self):
        # Affichage
        self.Append(wxpg.PropertyCategory(_(u"Affichage")))

        # Période à afficher
        # date_debut = DICT_INFOS_IMPRESSION["date_debut"]
        # date_fin = DICT_INFOS_IMPRESSION["date_fin"]
        # if date_debut != None and date_fin != None :
        #
        #     propriete = wxpg.StringProperty(label=_(u"Date de début"), name="date_debut", value=UTILS_Dates.DateDDEnFr(date_debut))
        #     propriete.SetEditor("EditeurDate")
        #     self.Append(propriete)
        #
        #     propriete = wxpg.StringProperty(label=_(u"Date de fin"), name="date_fin", value=UTILS_Dates.DateDDEnFr(date_fin))
        #     propriete.SetEditor("EditeurDate")
        #     self.Append(propriete)

        # Masquer dates anciennes
        propriete = wxpg.BoolProperty(label=_(u"Masquer les anciennes dates"),
                                      name="masquer_dates_anciennes",
                                      value=False)
        propriete.SetHelpString(
            _(u"Cochez cette case pour masquer les dates passées"))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Afficher observations
        propriete = wxpg.BoolProperty(label=_(u"Afficher les observations"),
                                      name="afficher_observations",
                                      value=False)
        propriete.SetHelpString(
            _(u"Cochez cette case pour afficher les observations"))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Page
        self.Append(wxpg.PropertyCategory(_(u"Page")))

        # Orientation page
        propriete = CTRL_Propertygrid.Propriete_choix(
            label=_(u"Orientation de la page"),
            name="orientation",
            liste_choix=[("portrait", _(u"Portrait")),
                         ("paysage", _(u"Paysage"))],
            valeur="portrait")
        propriete.SetEditor("EditeurChoix")
        propriete.SetHelpString(_(u"Sélectionnez l'orientation de la page"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        self.Append(wxpg.PropertyCategory(_(u"Couleurs de fond")))

        # Couleur
        propriete = wxpg.ColourProperty(label=_(u"Fond entêtes"),
                                        name="couleur_fond_entetes",
                                        value=wx.Colour(230, 230, 230))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=_(u"Fond colonne total"),
                                        name="couleur_fond_total",
                                        value=wx.Colour(245, 245, 245))
        propriete.SetHelpString(_(u"Sélectionnez une couleur"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        self.Append(wxpg.PropertyCategory(_(u"Texte")))

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte"),
                                     name="taille_texte",
                                     value=7)
        propriete.SetHelpString(
            _(u"Saisissez une taille de texte (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte", "SpinCtrl")

        # Taille police
        propriete = wxpg.IntProperty(label=_(u"Taille de texte du titre"),
                                     name="taille_texte_titre",
                                     value=9)
        propriete.SetHelpString(
            _(u"Saisissez une taille de texte (9 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte", "SpinCtrl")

        self.Append(wxpg.PropertyCategory(_(u"Colonnes")))

        # Largeur automatique
        propriete = wxpg.BoolProperty(label=_(u"Largeur auto ajustée"),
                                      name="largeur_colonnes_auto",
                                      value=True)
        propriete.SetHelpString(
            _(u"Cochez cette case pour laisser Noethys ajuster la largeur des colonnes automatiquement"
              ))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Largeur colonne labels
        propriete = wxpg.IntProperty(label=_(u"Largeur colonne date"),
                                     name="largeur_colonne_date",
                                     value=110)
        propriete.SetHelpString(
            _(u"Saisissez la largeur pour la colonne date (110 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_date", "SpinCtrl")
Exemple #28
0
    def Remplissage(self):
        listeChampsPiedsPages = [
            "{DATE_JOUR}", "{TITRE_DOCUMENT}", "{NOM_ORGANISATEUR}",
            "{NUM_PAGE}", "{NBRE_PAGES}"
        ]

        # --------------------------- Divers ------------------------------------------
        self.Append(wxpg.PropertyCategory("Divers"))

        # Inclure les images
        propriete = wxpg.BoolProperty(label=INCLURE_IMG_LABEL,
                                      name="inclure_images",
                                      value=True)
        propriete.SetHelpString(INCLURE_IMG_HELP)
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Entete de colonne sur chaque page
        propriete = wxpg.BoolProperty(label=AFFICHER_ENTETE_LABEL,
                                      name="entetes_toutes_pages",
                                      value=True)
        propriete.SetHelpString(AFFICHER_ENTETE_HELP)
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Qualité de l'impression
        propriete = wxpg.EnumProperty(label=CHOIX_QUALITE_LABEL,
                                      name="qualite_impression",
                                      labels=CHOIX_QUALITE_LABELS,
                                      values=CHOIX_QUALITE_VALEURS,
                                      value=wx.PRINT_QUALITY_MEDIUM)
        propriete.SetHelpString(CHOIX_QUALITE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Marges ------------------------------------------
        self.Append(wxpg.PropertyCategory("Marges"))

        # Gauche
        propriete = wxpg.IntProperty(label=MARGE_GAUCHE_LABEL,
                                     name="marge_gauche",
                                     value=5)
        propriete.SetHelpString(TAILLE_MARGE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("marge_gauche", "SpinCtrl")

        # Droite
        propriete = wxpg.IntProperty(label=MARGE_DROITE_LABEL,
                                     name="marge_droite",
                                     value=5)
        propriete.SetHelpString(TAILLE_MARGE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("marge_droite", "SpinCtrl")

        # Haut
        propriete = wxpg.IntProperty(label=MARGE_HAUT_LABEL,
                                     name="marge_haut",
                                     value=5)
        propriete.SetHelpString(TAILLE_MARGE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("marge_haut", "SpinCtrl")

        # Bas
        propriete = wxpg.IntProperty(label=MARGE_BAS_LABEL,
                                     name="marge_bas",
                                     value=5)
        propriete.SetHelpString(TAILLE_MARGE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("marge_bas", "SpinCtrl")

        # --------------------------- Quadrillage ------------------------------------------
        self.Append(wxpg.PropertyCategory("Quadrillage"))

        # Epaisseur de trait
        propriete = wxpg.FloatProperty(label=EPAISSEUR_TRAIT_LABEL,
                                       name="grille_trait_epaisseur",
                                       value=0.25)
        propriete.SetHelpString(EPAISSEUR_TRAIT_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur de trait
        propriete = wxpg.ColourProperty(label=COULEUR_TRAIT_LABEL,
                                        name="grille_trait_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TRAIT_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Titre de liste ------------------------------------------
        self.Append(wxpg.PropertyCategory("Titre"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="titre_taille_texte",
                                     value=16)
        propriete.SetHelpString(TAILLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("titre_taille_texte", "SpinCtrl")

        # Style
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="titre_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_BOLD)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="titre_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Alignement
        labels = ["Gauche", "Centre", "Droite"]
        propriete = wxpg.EnumProperty(label=ALIGNEMENT_TEXTE_LABEL,
                                      name="titre_alignement",
                                      labels=ALIGNEMENT_TEXTE_LABELS,
                                      values=ALIGNEMENT_TEXTE_VALUES,
                                      value=wx.ALIGN_LEFT)
        propriete.SetHelpString(ALIGNEMENT_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Intro ------------------------------------------
        self.Append(wxpg.PropertyCategory("Introduction"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="intro_taille_texte",
                                     value=7)
        propriete.SetHelpString(TAILLE_TEXTE_INTRO_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("intro_taille_texte", "SpinCtrl")

        # Style
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="intro_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_NORMAL)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="intro_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Alignement
        propriete = wxpg.EnumProperty(label=ALIGNEMENT_TEXTE_LABEL,
                                      name="intro_alignement",
                                      labels=ALIGNEMENT_TEXTE_LABELS,
                                      values=ALIGNEMENT_TEXTE_VALUES,
                                      value=wx.ALIGN_LEFT)
        propriete.SetHelpString(ALIGNEMENT_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Titre de colonne  ------------------------------------------
        self.Append(wxpg.PropertyCategory("Entête de colonne"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="titre_colonne_taille_texte",
                                     value=8)
        propriete.SetHelpString(TAILLE_TEXTE_TITRE_COL_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("titre_colonne_taille_texte", "SpinCtrl")

        #  Style
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="titre_colonne_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_NORMAL)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="titre_colonne_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Alignement
        propriete = wxpg.EnumProperty(label=ALIGNEMENT_TEXTE_LABEL,
                                      name="titre_colonne_alignement",
                                      labels=ALIGNEMENT_TEXTE_LABELS,
                                      values=ALIGNEMENT_TEXTE_VALUES,
                                      value=wx.ALIGN_CENTER)
        propriete.SetHelpString(ALIGNEMENT_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur de fond
        propriete = wxpg.ColourProperty(label=COULEUR_FOND_LABEL,
                                        name="titre_colonne_couleur_fond",
                                        value=wx.Colour(240, 240, 240))
        propriete.SetHelpString(COULEUR_FOND_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Ligne  ------------------------------------------
        self.Append(wxpg.PropertyCategory("Ligne"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="ligne_taille_texte",
                                     value=8)
        propriete.SetHelpString(TAILLE_TEXTE_LIGNE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("ligne_taille_texte", "SpinCtrl")

        #  Style
        labels = ["Normal", "Light", "Gras"]
        valeurs = [
            wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT, wx.FONTWEIGHT_BOLD
        ]
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="ligne_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_NORMAL)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="ligne_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Multilignes autorisé
        propriete = wxpg.BoolProperty(label=AUTORISER_SAUT_LIGNE_LABEL,
                                      name="ligne_multilignes",
                                      value=True)
        propriete.SetHelpString(AUTORISER_SAUT_LIGNE_HELP)
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # --------------------------- Pied de page  ------------------------------------------
        self.Append(wxpg.PropertyCategory("Pied de page"))

        # Texte de gauche
        valeur = "{DATE_JOUR}"
        propriete = wxpg.StringProperty(label=PIED_TEXTE_GAUCHE_LABEL,
                                        name="pied_page_texte_gauche",
                                        value=valeur)
        propriete.SetHelpString(
            "Saisissez le texte de gauche du pied de page (Par défaut '%s'). Vous pouvez intégrer les mots-clés suivants : %s"
            % (valeur, ", ".join(listeChampsPiedsPages)))
        self.Append(propriete)

        # Texte du milieu
        valeur = "{TITRE_DOCUMENT} - {NOM_ORGANISATEUR}"
        propriete = wxpg.StringProperty(label=PIED_TEXTE_MILIEU_LABEL,
                                        name="pied_page_texte_milieu",
                                        value=valeur)
        propriete.SetHelpString(
            "Saisissez le texte du milieu du pied de page (Par défaut '%s'). Vous pouvez intégrer les mots-clés suivants : %s"
            % (valeur, ", ".join(listeChampsPiedsPages)))
        self.Append(propriete)

        # Texte de droite
        valeur = "{NUM_PAGE} / {NBRE_PAGES}"
        propriete = wxpg.StringProperty(label=PIED_TEXTE_DROITE_LABEL,
                                        name="pied_page_texte_droite",
                                        value=valeur)
        propriete.SetHelpString(
            "Saisissez le texte de droite du pied de page (Par défaut '%s'). Vous pouvez intégrer les mots-clés suivants : %s"
            % (valeur, ", ".join(listeChampsPiedsPages)))
        self.Append(propriete)

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="pied_page_taille_texte",
                                     value=8)
        propriete.SetHelpString(TAILLE_TEXTE_PIED_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("pied_page_taille_texte", "SpinCtrl")

        #  Style
        labels = ["Normal", "Light", "Gras"]
        valeurs = [
            wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT, wx.FONTWEIGHT_BOLD
        ]
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="pied_page_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_NORMAL)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="pied_page_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Pied de colonne  ------------------------------------------
        self.Append(wxpg.PropertyCategory("Pied de colonne"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="pied_colonne_taille_texte",
                                     value=8)
        propriete.SetHelpString(TAILLE_TEXTE_PIED_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("pied_colonne_taille_texte", "SpinCtrl")

        #  Style
        labels = ["Normal", "Light", "Gras"]
        valeurs = [
            wx.FONTWEIGHT_NORMAL, wx.FONTWEIGHT_LIGHT, wx.FONTWEIGHT_BOLD
        ]
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="pied_colonne_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_NORMAL)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="pied_colonne_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Alignement
        labels = ["Gauche", "Centre", "Droite"]
        propriete = wxpg.EnumProperty(label=ALIGNEMENT_TEXTE_LABEL,
                                      name="pied_colonne_alignement",
                                      labels=ALIGNEMENT_TEXTE_LABELS,
                                      values=ALIGNEMENT_TEXTE_VALUES,
                                      value=wx.ALIGN_CENTER)
        propriete.SetHelpString(ALIGNEMENT_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur de fond
        propriete = wxpg.ColourProperty(label=COULEUR_FOND_LABEL,
                                        name="pied_colonne_couleur_fond",
                                        value=wx.Colour(240, 240, 240))
        propriete.SetHelpString(COULEUR_FOND_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # --------------------------- Pied de liste ------------------------------------------
        self.Append(wxpg.PropertyCategory("Conclusion"))

        # Taille police
        propriete = wxpg.IntProperty(label=TAILLE_TEXTE_LABEL,
                                     name="conclusion_taille_texte",
                                     value=7)
        propriete.SetHelpString(TAILLE_TEXTE_CONCL_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("conclusion_taille_texte", "SpinCtrl")

        # Style
        propriete = wxpg.EnumProperty(label=STYLE_TEXTE_LABEL,
                                      name="conclusion_style",
                                      labels=STYLE_TEXTE_LABELS,
                                      values=STYLE_TEXTE_VALEURS,
                                      value=wx.FONTWEIGHT_BOLD)
        propriete.SetHelpString(STYLE_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur
        propriete = wxpg.ColourProperty(label=COULEUR_TEXTE_LABEL,
                                        name="conclusion_couleur",
                                        value=wx.BLACK)
        propriete.SetHelpString(COULEUR_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Alignement
        labels = ["Gauche", "Centre", "Droite"]
        propriete = wxpg.EnumProperty(label=ALIGNEMENT_TEXTE_LABEL,
                                      name="conclusion_alignement",
                                      labels=ALIGNEMENT_TEXTE_LABELS,
                                      values=ALIGNEMENT_TEXTE_VALUES,
                                      value=wx.ALIGN_LEFT)
        propriete.SetHelpString(ALIGNEMENT_TEXTE_HELP)
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
Exemple #29
0
    def Remplissage(self):
        listeChamps = [
            "{SIGNATAIRE_GENRE}",
            "{SIGNATAIRE_NOM}",
            "{SIGNATAIRE_FONCTION}",
            "{NUM_ATTESTATION}",
            "{DATE_DEBUT}",
            "{DATE_FIN}",
            "{DATE_EDITION}",
            "{LIEU_EDITION}",
            "{NOMS_INDIVIDUS}",
            "{DESTINATAIRE_NOM}",
            "{DESTINATAIRE_RUE}",
            "{DESTINATAIRE_VILLE}",
            "{TOTAL_PERIODE}",
            "{TOTAL_REGLE}",
            "{SOLDE_DU}",
            "{ORGANISATEUR_NOM}",
            "{ORGANISATEUR_RUE}",
            "{ORGANISATEUR_CP}",
            "{ORGANISATEUR_VILLE}",
            "{ORGANISATEUR_TEL}",
            "{ORGANISATEUR_FAX}",
            "{ORGANISATEUR_MAIL}",
            "{ORGANISATEUR_SITE}",
            "{ORGANISATEUR_AGREMENT}",
            "{ORGANISATEUR_SIRET}",
            "{ORGANISATEUR_APE}",
        ]

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Modèle")))

        propriete = wxpg.EnumProperty(label=_(u"Modèle de document"),
                                      name="IDmodele",
                                      value=0)
        propriete.SetHelpString(
            _(u"Sélectionnez le modèle de document à utiliser"))
        propriete.SetEditor("EditeurComboBoxAvecBoutons")
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.MAJ_modeles()

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Signataire")))

        propriete = wxpg.EnumProperty(label=_(u"Signataire du document"),
                                      name="signataire",
                                      value=0)
        propriete.SetHelpString(
            _(u"Sélectionnez le signataire du document (à renseigner au préalable dans le paramétrage de l'activité)"
              ))
        propriete.SetAttribute("obligatoire", True)
        propriete.SetAttribute("reinitialisation_interdite", True)
        self.Append(propriete)
        self.MAJ_signataires()

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Mémorisation")))

        # Mémorisation des paramètres
        propriete = wxpg.BoolProperty(label=_(u"Mémoriser les paramètres"),
                                      name="memoriser_parametres",
                                      value=True)
        propriete.SetHelpString(
            _(u"Cochez cette case si vous souhaitez mémoriser les paramètres de cette liste"
              ))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        # Répertoire de sauvegarde
        propriete = wxpg.DirProperty(label=_(u"Répertoire pour copie unique"),
                                     name="repertoire_copie",
                                     value="")
        propriete.SetHelpString(
            _(u"Enregistrer une copie unique de chaque document dans le répertoire sélectionné. Sinon laissez vide ce champ."
              ))
        self.Append(propriete)

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Titre")))

        # Afficher le titre
        propriete = wxpg.BoolProperty(label=_(u"Afficher le titre"),
                                      name="afficher_titre",
                                      value=True)
        propriete.SetHelpString(
            _(u"Cochez cette case si vous souhaitez afficher le titre du le document"
              ))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        propriete = wxpg.StringProperty(label=_(u"Titre du document"),
                                        name="texte_titre",
                                        value=_(u"Attestation de présence"))
        propriete.SetHelpString(
            _(u"Saisissez le titre du document (Par défaut 'Attestation de présence'). Vous pouvez intégrer les mots-clés suivants : %s"
              ) % ", ".join(listeChamps))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.IntProperty(label=_(u"Taille de texte du titre"),
                                     name="taille_texte_titre",
                                     value=19)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte du titre (29 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_titre", "SpinCtrl")

        propriete = wxpg.BoolProperty(
            label=_(u"Afficher la période de facturation"),
            name="afficher_periode",
            value=True)
        propriete.SetHelpString(
            _(u"Cochez cette case si vous souhaitez afficher la période de facturation dans le document"
              ))
        propriete.SetAttribute("UseCheckbox", True)
        self.Append(propriete)

        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte de la période"),
            name="taille_texte_periode",
            value=8)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte de la période (8 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_periode", "SpinCtrl")

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Tableau des prestations")))

        # Affichage condensé ou détaillé
        propriete = wxpg.EnumProperty(
            label=_(u"Affichage des prestations"),
            name="affichage_prestations",
            labels=[_(u"Détaillé"), _(u"Condensé")],
            values=[0, 1],
            value=0)
        propriete.SetHelpString(_(u"Sélectionnez un type d'affichage"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Intitulés des prestations
        labels = [
            _(u"Intitulé original"),
            _(u"Intitulé original + état 'Absence injustifiée'"),
            _(u"Nom du tarif"),
            _(u"Nom de l'activité")
        ]
        propriete = wxpg.EnumProperty(label=_(u"Intitulés des prestations"),
                                      name="intitules",
                                      labels=labels,
                                      values=[0, 1, 2, 3],
                                      value=0)
        propriete.SetHelpString(
            _(u"Sélectionnez le type d'intitulé à afficher pour les prestations"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur 1
        propriete = wxpg.ColourProperty(label=_(u"Couleur de fond 1"),
                                        name="couleur_fond_1",
                                        value=wx.Colour(204, 204, 255))
        propriete.SetHelpString(_(u"Sélectionnez la couleur 1"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Couleur 2
        propriete = wxpg.ColourProperty(label=_(u"Couleur de fond 2"),
                                        name="couleur_fond_2",
                                        value=wx.Colour(234, 234, 255))
        propriete.SetHelpString(_(u"Sélectionnez la couleur 2"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        # Largeur colonne Date
        propriete = wxpg.IntProperty(
            label=_(u"Largeur de la colonne Date (ou Qté)"),
            name="largeur_colonne_date",
            value=50)
        propriete.SetHelpString(
            _(u"Saisissez la largeur de la colonne Date (50 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_date", "SpinCtrl")

        # Largeur colonne Montant HT
        propriete = wxpg.IntProperty(
            label=_(u"Largeur de la colonne Montant HT"),
            name="largeur_colonne_montant_ht",
            value=50)
        propriete.SetHelpString(
            _(u"Saisissez la largeur de la colonne Montant HT (50 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_montant_ht", "SpinCtrl")

        # Largeur colonne Montant TVA
        propriete = wxpg.IntProperty(
            label=_(u"Largeur de la colonne Montant TVA"),
            name="largeur_colonne_montant_tva",
            value=50)
        propriete.SetHelpString(
            _(u"Saisissez la largeur de la colonne Montant TVA (50 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_montant_tva", "SpinCtrl")

        # Largeur colonne Montant TTC
        propriete = wxpg.IntProperty(
            label=_(u"Largeur de la colonne Montant TTC"),
            name="largeur_colonne_montant_ttc",
            value=70)
        propriete.SetHelpString(
            _(u"Saisissez la largeur de la colonne Montant TTC (70 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("largeur_colonne_montant_ttc", "SpinCtrl")

        # Taille de texte du nom de l'individu
        propriete = wxpg.IntProperty(label=_(u"Taille de texte de l'individu"),
                                     name="taille_texte_individu",
                                     value=9)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte de l'individu (9 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_individu", "SpinCtrl")

        # Taille de texte du nom de l'activité
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte de l'activité"),
            name="taille_texte_activite",
            value=6)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte de l'activité (6 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_activite", "SpinCtrl")

        # Taille de texte des noms de colonnes
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte des noms de colonnes"),
            name="taille_texte_noms_colonnes",
            value=5)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte des noms de colonnes (5 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_noms_colonnes", "SpinCtrl")

        # Taille de texte des prestations
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte des prestations"),
            name="taille_texte_prestation",
            value=7)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte des prestations (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_prestation", "SpinCtrl")

        # Taille de texte des messages
        propriete = wxpg.IntProperty(label=_(u"Taille de texte des messages"),
                                     name="taille_texte_messages",
                                     value=7)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte des messages (7 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_messages", "SpinCtrl")

        # Taille de texte des labels totaux
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte des labels totaux"),
            name="taille_texte_labels_totaux",
            value=9)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte des labels totaux (9 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_labels_totaux", "SpinCtrl")

        # Taille de texte des totaux
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte des montants totaux"),
            name="taille_texte_montants_totaux",
            value=10)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte des montants totaux (10 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_montants_totaux", "SpinCtrl")

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Prestations antérieures")))

        # Taille de texte
        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte du commentaire"),
            name="taille_texte_prestations_anterieures",
            value=5)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte du commentaire de bas de tableaux (5 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_prestations_anterieures",
                               "SpinCtrl")

        # Texte d'information
        propriete = wxpg.LongStringProperty(
            label=_(u"Texte d'information"),
            name="texte_prestations_anterieures",
            value=
            _(u"Des prestations antérieures ont été reportées sur cette attestation."
              ))
        propriete.SetHelpString(
            _(u"Saisissez un texte d'information pour les prestations antérieures"
              ))
        self.Append(propriete)

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Texte d'introduction")))

        propriete = wxpg.LongStringProperty(label=_(u"Texte d'introduction"),
                                            name="texte_introduction",
                                            value=TEXTE_INTRO)
        propriete.SetHelpString(
            _(u"Saisissez un texte d'introduction. Vous pouvez intégrer les mots-clés suivants : %s"
              ) % ", ".join(listeChamps))
        self.Append(propriete)

        propriete = wxpg.IntProperty(
            label=_(u"Taille de texte d'introduction"),
            name="taille_texte_introduction",
            value=9)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte d'introduction (9 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_introduction", "SpinCtrl")

        propriete = wxpg.EnumProperty(label=_(u"Style de texte introduction"),
                                      name="style_texte_introduction",
                                      labels=[
                                          _(u"Normal"),
                                          _(u"Italique"), "Gras",
                                          _(u"Italique + Gras")
                                      ],
                                      values=[0, 1, 2, 3],
                                      value=1)
        propriete.SetHelpString(_(u"Sélectionnez un style de texte"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.ColourProperty(
            label=_(u"Couleur de fond introduction"),
            name="couleur_fond_introduction",
            value=wx.Colour(255, 255, 255))
        propriete.SetHelpString(
            _(u"Sélectionnez une couleur de fond pour le texte d'introduction"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.ColourProperty(
            label=_(u"Couleur de bord introduction"),
            name="couleur_bord_introduction",
            value=wx.Colour(255, 255, 255))
        propriete.SetHelpString(
            _(u"Sélectionnez une couleur de bord pour le texte d'introduction"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.EnumProperty(
            label=_(u"Alignement du texte d'introduction"),
            name="alignement_texte_introduction",
            labels=[_(u"Gauche"), _(u"Centre"),
                    _(u"Droite")],
            values=[0, 1, 2],
            value=1)
        propriete.SetHelpString(
            _(u"Sélectionnez un type d'alignement pour le texte d'introduction"
              ))
        self.Append(propriete)

        # Catégorie
        self.Append(wxpg.PropertyCategory(_(u"Texte de conclusion")))

        propriete = wxpg.LongStringProperty(label=_(u"Texte de conclusion"),
                                            name="texte_conclusion",
                                            value=u"")
        propriete.SetHelpString(
            _(u"Saisissez un texte de conclusion (Aucun par défaut). Vous pouvez intégrer les mots-clés suivants : %s"
              ) % ", ".join(listeChamps))
        self.Append(propriete)

        propriete = wxpg.IntProperty(label=_(u"Taille de texte de conclusion"),
                                     name="taille_texte_conclusion",
                                     value=9)
        propriete.SetHelpString(
            _(u"Saisissez la taille de texte de conclusion (9 par défaut)"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_texte_conclusion", "SpinCtrl")

        propriete = wxpg.EnumProperty(label=_(u"Style de texte conclusion"),
                                      name="style_texte_conclusion",
                                      labels=[
                                          _(u"Normal"),
                                          _(u"Italique"), "Gras",
                                          _(u"Italique + Gras")
                                      ],
                                      values=[0, 1, 2, 3],
                                      value=0)
        propriete.SetHelpString(_(u"Sélectionnez un style de texte"))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.ColourProperty(label=_(u"Couleur de fond conclusion"),
                                        name="couleur_fond_conclusion",
                                        value=wx.Colour(255, 255, 255))
        propriete.SetHelpString(
            _(u"Sélectionnez une couleur de fond pour le texte de conclusion")
        )
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.ColourProperty(label=_(u"Couleur de bord conclusion"),
                                        name="couleur_bord_conclusion",
                                        value=wx.Colour(255, 255, 255))
        propriete.SetHelpString(
            _(u"Sélectionnez une couleur de bord pour le texte de conclusion")
        )
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)

        propriete = wxpg.EnumProperty(
            label=_(u"Alignement du texte de conclusion"),
            name="alignement_texte_conclusion",
            labels=[_(u"Gauche"), _(u"Centre"),
                    _(u"Droite")],
            values=[0, 1, 2],
            value=0)
        propriete.SetHelpString(
            _(u"Sélectionnez un type d'alignement pour le texte de conclusion"
              ))
        self.Append(propriete)

        # Signature
        self.Append(wxpg.PropertyCategory(_(u"Signature")))

        propriete = wxpg.ImageFileProperty(label=_(u"Image de signature"),
                                           name="image_signature")
        propriete.SetHelpString(
            _(u"Sélectionnez l'image d'une signature à insérer en fin de document"
              ))
        self.Append(propriete)

        propriete = wxpg.IntProperty(label=_(u"Taille de l'image (en %)"),
                                     name="taille_image_signature",
                                     value=100)
        propriete.SetHelpString(
            _(u"Saisissez la taille de l'image en pourcentage (100 par défaut)"
              ))
        propriete.SetAttribute("obligatoire", True)
        self.Append(propriete)
        self.SetPropertyEditor("taille_image_signature", "SpinCtrl")

        propriete = wxpg.EnumProperty(
            label=_(u"Alignement de l'image"),
            name="alignement_image_signature",
            labels=[_(u"Gauche"), _(u"Centre"),
                    _(u"Droite")],
            values=[0, 1, 2],
            value=0)
        propriete.SetHelpString(
            _(u"Sélectionnez un type d'alignement pour l'image de signature"))
        self.Append(propriete)
Exemple #30
0
    def __init__(self, RunForm, parent ):
        wx.Notebook.__init__(self, parent, style=wx.BK_DEFAULT, size=(500, 50) )

        # Create panels and pages for each of the three notebook tabs.
        parameterGridPanel = wx.Panel(self, -1)
        settingsPanel = wx.Panel(self, -1)
        executionPanel = wx.Panel(self, -1)

        self.AddPage(parameterGridPanel, "Parameter Grid")
        self.AddPage(settingsPanel, "Run Configuration")
        self.AddPage(executionPanel, "Resources and Execution")

        # ***** PARAMETER GRID TAB *****
        parameterGridSizer = wx.BoxSizer( wx.HORIZONTAL )
        RunForm.speciesGrid = ParameterGrid( parameterGridPanel, RunForm.run )
        parameterGridSizer.Add( RunForm.speciesGrid, 1, wx.EXPAND )
        parameterGridPanel.SetSizerAndFit( parameterGridSizer )

        # Create the parameter grid control.
        RunForm.speciesGrid.CreateGrid( RunForm.run.species.numRows, RunForm.run.species.numColumns )
        RunForm.speciesGrid.SetColLabelValue( 0, "Parameter" )
        RunForm.speciesGrid.SetColLabelValue( 1, "Type")
        RunForm.speciesGrid.SetColLabelValue( 2, "Value(s)")
        RunForm.speciesGrid.SetColLabelValue( 3, "Directory Order")
        RunForm.speciesGrid.SetColSize( 3, 100 )

        # ***** RUN SETTINGS TAB *****
        runSettingsSizer = wx.BoxSizer( wx.VERTICAL )
        RunForm.runPropertiesGrid = wx_propgrid.PropertyGrid( settingsPanel, size=(300, 300) )
        runSettingsSizer.Add( RunForm.runPropertiesGrid, 2, wx.EXPAND )
        settingsPanel.SetSizerAndFit( runSettingsSizer )

        RunForm.runPropertiesGrid.Append( wx_propgrid.PropertyCategory( "Basic Script Properties" ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.StringProperty( "Script filename", "scriptFilename", RunForm.run.runSettings.scriptFilename ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.DirProperty( "Script output location", "scriptLocation", RunForm.run.runSettings.scriptLocation ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.LongStringProperty( "Run notes", "runNotes", RunForm.run.runNotes ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.PropertyCategory( "Executable Properties" ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.FileProperty( "Executable filename", "executableFilename", RunForm.run.runSettings.executableFilename ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.FileProperty( "Output filename", "outputFilename", RunForm.run.runSettings.outputFilename ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.FileProperty( "Input filename", "inputFilename", RunForm.run.runSettings.inputFilename ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.DirProperty( "Source path", "sourcePath", RunForm.run.runSettings.sourcePath ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.PropertyCategory( "Basic Script Tasks" ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.BoolProperty("Compile executable from source", "optionCompileSource", RunForm.run.runSettings.optionCompileSource ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.BoolProperty("Build directory structure", "optionBuildDirectoryStructure", RunForm.run.runSettings.optionBuildDirectoryStructure ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.BoolProperty("Disable input redirection", "optionDisableInputRedirection", RunForm.run.runSettings.optionDisableInputRedirection ) )
        RunForm.runPropertiesGrid.Append( wx_propgrid.BoolProperty("Generate status check script", "optionGenerateCheckStatusScript", RunForm.run.runSettings.optionGenerateCheckStatusScript ) )

        # ***** RESOURCES AND EXECUTION PANEL *****
        executionSettingsSizer = wx.BoxSizer( wx.VERTICAL )
        RunForm.singleMachinePropertyGrid = wx_propgrid.PropertyGrid( executionPanel )
        RunForm.executionChoiceBook = wx.Choicebook( executionPanel, id=wx.ID_ANY )
        executionSettingsSizer.Add( RunForm.executionChoiceBook, 1, wx.EXPAND )
        executionPanel.SetSizerAndFit( executionSettingsSizer )

        panelSingleMachine = wx.Panel( RunForm.executionChoiceBook )
        panelPBS = wx.Panel( RunForm.executionChoiceBook )
        panelSingleMachineMPI = wx.Panel( RunForm.executionChoiceBook )
        panelPBSMPI = wx.Panel( RunForm.executionChoiceBook )

        RunForm.executionChoiceBook.AddPage( panelSingleMachine, "Single Machine or Interactive Job (Recovery Enabled)")
        RunForm.executionChoiceBook.AddPage( panelPBS, "PBS Scheduler on Cluster")
        #RunForm.executionChoiceBook.AddPage( panelSingleMachineMPI, "Single Machine or Interactive Job using MPI")
        #RunForm.executionChoiceBook.AddPage( panelPBSMPI, "PBS Scheduler on Cluster using MPI")

        # SINGLE MACHINE SETTINGS
        RunForm.propertyGridSingleMachine = wx_propgrid.PropertyGrid( panelSingleMachine )
        sizerGridSingleMachine = wx.BoxSizer( wx.VERTICAL )
        sizerGridSingleMachine.Add( RunForm.propertyGridSingleMachine, 1, wx.EXPAND )
        panelSingleMachine.SetSizerAndFit( sizerGridSingleMachine )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.PropertyCategory( "Resources" ) )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.IntProperty( "Number of simultaneous runs", "numSimRuns", RunForm.run.availableModules.SingleMachineResourceManager.numSimRuns ) )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.IntProperty( "Process status check delay (seconds)", "procCheckWaitTime", RunForm.run.availableModules.SingleMachineResourceManager.procCheckWaitTime ) )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.PropertyCategory( "Additional Commands" ) )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.LongStringProperty( "Additional pre-execution commands", "additionalPreExecutionCommands", RunForm.run.availableModules.SingleMachineResourceManager.additionalPreExecutionCommands ) )
        RunForm.propertyGridSingleMachine.Append( wx_propgrid.LongStringProperty( "Additional post-execution commands", "additionalPostExecutionCommands", RunForm.run.availableModules.SingleMachineResourceManager.additionalPostExecutionCommands ) )

        # PBS SETTINGS
        RunForm.propertyGridPBS = wx_propgrid.PropertyGrid( panelPBS )
        sizerGridPBS = wx.BoxSizer( wx.VERTICAL )
        sizerGridPBS.Add( RunForm.propertyGridPBS, 1, wx.EXPAND )
        panelPBS.SetSizerAndFit( sizerGridPBS )
        RunForm.propertyGridPBS.Append( wx_propgrid.PropertyCategory( "PBS Settings" ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.IntProperty( "Number of nodes", "numNodes", RunForm.run.availableModules.PBSResourceManager.numNodes ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.IntProperty( "Processors per node (ppn)", "processorsPerNode", RunForm.run.availableModules.PBSResourceManager.processorsPerNode ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.StringProperty( "Walltime", "walltime", RunForm.run.availableModules.PBSResourceManager.walltime ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.PropertyCategory( "Additional Commands" ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.LongStringProperty( "Additional pre-execution commands", "additionalPreExecutionCommands", RunForm.run.availableModules.PBSResourceManager.additionalPreExecutionCommands ) )
        RunForm.propertyGridPBS.Append( wx_propgrid.LongStringProperty( "Additional post-execution commands", "additionalPostExecutionCommands", RunForm.run.availableModules.PBSResourceManager.additionalPostExecutionCommands ) )