Example #1
0
    def __init__(self, parent, id, title, mandoc):
        self.command = mandoc['command']
        wx.Frame.__init__(self, parent, id, title, size=(600, 400))

        panel = wx.Panel(self, -1)

        vbox = wx.BoxSizer(wx.VERTICAL)
        hbox = wx.BoxSizer(wx.HORIZONTAL)

        leftPanel = wx.Panel(panel, -1)
        rightPanel = wx.Panel(panel, -1)

        self.log = wx.TextCtrl(rightPanel, -1, style=wx.TE_MULTILINE)
        self.list = CheckListCtrl(rightPanel)
        self.list.InsertColumn(0, 'flag', width=140)
        self.list.InsertColumn(1, 'short flag')
        self.list.InsertColumn(2, 'help')

        for i in mandoc['options']:
            flags = i[0]
            flags.sort(key=len, reverse=True)
            index = self.list.InsertStringItem(sys.maxint, flags[0])
            self.list.SetStringItem(
                index, 1, flags[1] if len(flags) > 1 else '')
            self.list.SetStringItem(index, 2, i[1])

        vbox2 = wx.BoxSizer(wx.VERTICAL)

        sel = wx.Button(leftPanel, -1, 'Select All', size=(100, -1))
        des = wx.Button(leftPanel, -1, 'Deselect All', size=(100, -1))
        apply = wx.Button(leftPanel, -1, 'Run', size=(100, -1))
        self.cb_close = wx.CheckBox(leftPanel, -1, 'Close', size=(100, -1))
        self.cb_close.SetToolTip(
            wx.ToolTip("close GUI after running the command"))
        self.cb_term = wx.CheckBox(
            leftPanel, -1, 'new terminal', size=(100, -1))
        self.cb_term.SetToolTip(wx.ToolTip("run command in new terminal"))
        bt_exit = wx.Button(leftPanel, -1, 'Exit', size=(100, -1))

        self.Bind(wx.EVT_BUTTON, self.OnSelectAll, id=sel.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnDeselectAll, id=des.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnApply, id=apply.GetId())
        self.Bind(wx.EVT_BUTTON, self.OnExit, id=bt_exit.GetId())

        vbox2.Add(sel, 0, wx.TOP, 5)
        vbox2.Add(des)
        vbox2.Add(apply)
        vbox2.Add(self.cb_close)
        vbox2.Add(self.cb_term)
        vbox2.Add(bt_exit)

        leftPanel.SetSizer(vbox2)

        vbox.Add(self.list, 1, wx.EXPAND | wx.TOP, 3)
        vbox.Add((-1, 10))
        vbox.Add(self.log, 0.5, wx.EXPAND)
        vbox.Add((-1, 10))

        rightPanel.SetSizer(vbox)

        hbox.Add(leftPanel, 0, wx.EXPAND | wx.RIGHT, 5)
        hbox.Add(rightPanel, 1, wx.EXPAND)
        hbox.Add((3, -1))

        panel.SetSizer(hbox)

        self.Centre()
        self.Show(True)

        self.list.OnCheckItem = self.OnCheckItem

        cmd = self.cmd()
        self.log.SetValue(cmd)
 def __set_properties(self):
     self.ctrl_nom.SetMinSize((420, -1))
     self.ctrl_nom.SetToolTip(
         wx.ToolTip(
             _(u"Saisissez ici l'intitulé de l'évènement (Ex : 'Cinéma', 'Yoga'...)"
               )))
     self.ctrl_description.SetToolTip(
         wx.ToolTip(
             _(u"[Optionnel] Saisissez ici une description pour cet évènement"
               )))
     self.ctrl_heure_debut.SetToolTip(
         wx.ToolTip(
             _(u"[Optionnel] Saisissez l'heure de début de l'évènement (Ex : 08:30)"
               )))
     self.ctrl_heure_fin.SetToolTip(
         wx.ToolTip(
             _(u"[Optionnel] Saisissez l'heure de fin de l'évènement (Ex : 09:30)"
               )))
     self.radio_tarification_aucune.SetToolTip(
         wx.ToolTip(
             _(u"Aucune tarification spécifique pour cet évènement")))
     self.radio_tarification_montant.SetToolTip(
         wx.ToolTip(_(u"Un montant fixe est associé à cet évènement")))
     self.radio_tarification_tarif.SetToolTip(
         wx.ToolTip(
             _(u"Un ou plusieurs tarifs avancés sont associés à cet évènement"
               )))
     self.ctrl_montant.SetToolTip(
         wx.ToolTip(_(u"Saisissez un montant fixe pour cet évènement")))
     self.bouton_ajouter.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour ajouter un tarif")))
     self.bouton_modifier.SetToolTip(
         wx.ToolTip(
             _(u"Cliquez ici pour modifier le tarif sélectionné dans la liste"
               )))
     self.bouton_supprimer.SetToolTip(
         wx.ToolTip(
             _(u"Cliquez ici pour supprimer le tarif sélectionné dans la liste"
               )))
     self.check_limitation_inscrits.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case pour définir un nombre d'inscrits maximal pour cet évènement"
               )))
     self.ctrl_limitation_inscrits.SetToolTip(
         wx.ToolTip(
             _(u"Saisissez ici une nombre d'inscrits maximal pour cet évènement"
               )))
     self.bouton_aide.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour valider et fermer")))
     self.bouton_annuler.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour annuler et fermer")))
 def __set_properties(self):
     self.bouton_modifier.SetToolTip(wx.ToolTip(_(u"Modifier les paramètres du compte internet")))
     #self.bouton_envoi_mail.SetToolTip(wx.ToolTip(_(u"Envoyer un couriel à la famille avec les codes d'accès au portail Internet")))
     self.bouton_envoi_pressepapiers.SetToolTip(wx.ToolTip(_(u"Copier les codes d'accès dans le presse-papiers afin de les coller ensuite dans un document ou un email par exemple")))
     #self.bouton_historique.SetToolTip(wx.ToolTip(_(u"Consulter et traiter les demandes de l'utilisateur")))
     self.ctrl_sexe.SetToolTip(wx.ToolTip(_(u"Sélectionnez le sexe de l'utilisateur")))
     self.ctrl_sexe.SetSelection(0)
     self.ctrl_nom.SetToolTip(wx.ToolTip(_(u"Saisissez ici le nom de famille de l'utilisateur")))
     self.ctrl_prenom.SetToolTip(wx.ToolTip(_(u"Saisissez ici le prénom de l'utilisateur")))
     self.radio_droits_admin.SetToolTip(wx.ToolTip(_(u"Sélectionnez l'option 'Administrateur' pour donner tous les droits à cet utilisateur")))
     self.radio_droits_modele.SetToolTip(wx.ToolTip(_(u"Sélectionnez cette option pour attribuer un modèle de droits à cet utilisateur")))
     self.radio_droits_perso.SetToolTip(wx.ToolTip(_(u"Sélectionnez cette option pour attribuer des droits personnalisés à cet utilisateur")))
     self.ctrl_actif.SetToolTip(wx.ToolTip(_(u"Décochez cette case pour désactiver l'utilisateur. L'utilisateur n'aura plus accès à ce fichier de données.")))
     self.bouton_modif_mdp.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour saisir un nouveau mot de passe pour cet utilisateur")))
     self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider")))
     self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour annuler")))
     self.SetMinSize((850, 750))
Example #4
0
def add_laser_controls(self, root, parentpanel):

    pos_mapping = {
        "htemp_label": (2, 0),
        "htemp_off": (2, 2),
        "htemp_val": (2, 3),
        "htemp_set": (2, 4),
    }

    span_mapping = {
        "htemp_label": (2, 2),
        "htemp_off": (1, 1),
        "htemp_val": (1, 1),
        "htemp_set": (1, 1 if root.display_graph else 2),
    }

    def add(name, widget, *args, **kwargs):
        kwargs["pos"] = pos_mapping[name]
        if name in span_mapping:
            kwargs["span"] = span_mapping[name]
        if "container" in kwargs:
            container = kwargs["container"]
            del kwargs["container"]
        else:
            container = self
        container.Add(widget, *args, **kwargs)

    # Hotend & bed temperatures #

    # Hotend temp
    add("htemp_label",
        wx.StaticText(parentpanel, -1, _("Heat:")),
        flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
    htemp_choices = [
        root.temps[i] + " (" + i + ")"
        for i in sorted(root.temps.keys(), key=lambda x: root.temps[x])
    ]

    root.settoff = make_button(parentpanel,
                               _("Off"),
                               lambda e: root.do_settemp("off"),
                               _("Switch Hotend Off"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.settoff)
    add("htemp_off", root.settoff)

    if root.settings.last_temperature not in map(float, root.temps.values()):
        htemp_choices = [str(root.settings.last_temperature)] + htemp_choices
    root.htemp = wx.ComboBox(parentpanel,
                             -1,
                             choices=htemp_choices,
                             style=wx.CB_DROPDOWN,
                             size=(80, -1))
    root.htemp.SetToolTip(wx.ToolTip(_("Select Temperature for Hotend")))
    root.htemp.Bind(wx.EVT_COMBOBOX, root.htemp_change)

    add("htemp_val", root.htemp)
    root.settbtn = make_button(parentpanel,
                               _("Set"),
                               root.do_settemp,
                               _("Switch Hotend On"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.settbtn)
    add("htemp_set", root.settbtn, flag=wx.EXPAND)
Example #5
0
    def __init__(self, parent):
        wx.Panel.__init__(self,
                          parent,
                          id=wx.ID_ANY,
                          pos=wx.DefaultPosition,
                          size=wx.DefaultSize,
                          style=wx.TAB_TRAVERSAL)
        self.charEditor = self.Parent.Parent  # first parent is Notebook, second is Character Editor
        self.SetBackgroundColour(
            wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))

        pmainSizer = wx.BoxSizer(wx.VERTICAL)

        hSizer = wx.BoxSizer(wx.HORIZONTAL)

        self.clonesChoice = wx.Choice(self, wx.ID_ANY, style=0)
        i = self.clonesChoice.Append("Omega Clone", None)
        self.clonesChoice.SetSelection(i)
        hSizer.Add(self.clonesChoice, 5, wx.ALL | wx.EXPAND, 5)

        self.searchInput = PlaceholderTextCtrl(self,
                                               wx.ID_ANY,
                                               placeholder="Search...")
        hSizer.Add(self.searchInput, 1, wx.ALL | wx.EXPAND, 5)
        self.searchInput.Bind(wx.EVT_TEXT, self.delaySearch)

        sChar = Character.getInstance()
        self.alphaClones = sChar.getAlphaCloneList()
        char = self.charEditor.entityEditor.getActiveEntity()

        for clone in self.alphaClones:
            i = self.clonesChoice.Append(clone.alphaCloneName, clone.ID)
            if clone.ID == char.alphaCloneID:
                self.clonesChoice.SetSelection(i)

        self.clonesChoice.Bind(wx.EVT_CHOICE, self.cloneChanged)

        self.clonesChoice.SetToolTip(
            wx.ToolTip(
                "Setting an Alpha clone does not replace the character's skills, but rather caps them to Alpha levels."
            ))

        pmainSizer.Add(hSizer, 0, wx.EXPAND | wx.ALL, 5)

        # Set up timer for skill search
        self.searchTimer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.populateSkillTreeSkillSearch,
                  self.searchTimer)

        tree = self.skillTreeListCtrl = wx.gizmos.TreeListCtrl(
            self, wx.ID_ANY, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT)
        pmainSizer.Add(tree, 1, wx.EXPAND | wx.ALL, 5)

        self.imageList = wx.ImageList(16, 16)
        tree.SetImageList(self.imageList)
        self.skillBookImageId = self.imageList.Add(
            BitmapLoader.getBitmap("skill_small", "gui"))

        tree.AddColumn("Skill")
        tree.AddColumn("Level")
        tree.SetMainColumn(0)

        self.root = tree.AddRoot("Skills")
        tree.SetItemText(self.root, "Levels", 1)

        tree.SetColumnWidth(0, 500)

        self.btnSecStatus = wx.Button(
            self, wx.ID_ANY, "Sec Status: {0:.2f}".format(char.secStatus
                                                          or 0.0))
        self.btnSecStatus.Bind(wx.EVT_BUTTON, self.onSecStatus)

        self.populateSkillTree()

        tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup)
        tree.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.scheduleMenu)

        bSizerButtons = wx.BoxSizer(wx.HORIZONTAL)

        bSizerButtons.Add(self.btnSecStatus, 0, wx.ALL, 5)

        bSizerButtons.AddSpacer((0, 0), 1, wx.EXPAND, 5)

        importExport = (("Import", wx.ART_FILE_OPEN, "from"),
                        ("Export", wx.ART_FILE_SAVE_AS, "to"))

        for name, art, direction in importExport:
            bitmap = wx.ArtProvider.GetBitmap(art, wx.ART_BUTTON)
            btn = wx.BitmapButton(self, wx.ID_ANY, bitmap)

            btn.SetMinSize(btn.GetSize())
            btn.SetMaxSize(btn.GetSize())

            btn.Layout()
            setattr(self, "{}Btn".format(name.lower()), btn)
            btn.Enable(True)
            btn.SetToolTipString("%s skills %s clipboard" % (name, direction))
            bSizerButtons.Add(
                btn, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_RIGHT | wx.ALL,
                5)
            btn.Bind(wx.EVT_BUTTON,
                     getattr(self, "{}Skills".format(name.lower())))

        pmainSizer.Add(bSizerButtons, 0, wx.EXPAND, 5)

        # bind the Character selection event
        self.charEditor.entityEditor.Bind(wx.EVT_CHOICE, self.charChanged)
        self.charEditor.Bind(GE.CHAR_LIST_UPDATED, self.populateSkillTree)

        srcContext = "skillItem"
        itemContext = "Skill"
        context = (srcContext, itemContext)
        self.statsMenu = ContextMenu.getMenu(None, context)
        self.levelChangeMenu = ContextMenu.getMenu(None, context) or wx.Menu()
        self.levelChangeMenu.AppendSeparator()
        self.levelIds = {}

        idUnlearned = wx.NewId()
        self.levelIds[idUnlearned] = "Not learned"
        self.levelChangeMenu.Append(idUnlearned, "Unlearn")

        for level in xrange(6):
            id = wx.NewId()
            self.levelIds[id] = level
            self.levelChangeMenu.Append(id, "Level %d" % level)

        self.levelChangeMenu.AppendSeparator()
        self.revertID = wx.NewId()
        self.levelChangeMenu.Append(self.revertID, "Revert")

        self.saveID = wx.NewId()
        self.levelChangeMenu.Append(self.saveID, "Save")

        self.levelChangeMenu.Bind(wx.EVT_MENU, self.changeLevel)
        self.SetSizer(pmainSizer)

        self.Layout()
    def __init__(self, parent, log, beacon, **args):
        wx.Frame.__init__(self,
                          parent,
                          -1,
                          "RTP Beacon View",
                          size=(400, 300),
                          **args)
        self.log = log
        self.beacon = beacon

        self.SetIcon(icons.getAGIconIcon())
        self.running = 1
        self.updateThread = None

        self.panel = wx.Panel(self, -1)

        # Build up the user interface
        self.SetLabel("Multicast Connectivity")

        # - sizer for pulldowns
        self.topsizer = wx.BoxSizer(wx.HORIZONTAL)

        # - pulldown for group to monitor (currently only beacon group, later audio/video)
        choices = ['Beacon']
        self.groupBox = wx.Choice(self.panel, -1, choices=choices)
        self.groupBox.SetSelection(0)

        # - pulldown for data to display (currently only fract.loss, later delay/jitter/cum.loss)
        choices = ['Fractional Loss']
        self.dataTypeBox = wx.Choice(self.panel, -1, choices=choices)
        self.dataTypeBox.SetSelection(0)

        self.label = wx.StaticText(self.panel, -1, "")

        self.topsizer.Add(self.groupBox, 0, wx.ALL, 2)
        self.topsizer.Add(self.dataTypeBox, 0, wx.ALL, 2)
        self.topsizer.Add(self.label, 1, wx.EXPAND | wx.ALL, 2)

        # Create the beacon grid
        self.grid = wx.grid.Grid(self.panel, -1)
        self.grid.SetToolTip(wx.ToolTip("test"))
        self.grid.EnableEditing(False)
        self.grid.SetColLabelSize(0)
        self.grid.SetRowLabelAlignment(wx.LEFT, wx.BOTTOM)
        self.grid.DisableDragRowSize()
        self.grid.DisableDragColSize()
        self.grid.SetRowLabelSize(150)
        self.grid.SetDefaultColSize(40)
        self.grid.EnableScrolling(1, 1)
        self.grid.CreateGrid(1, 1)

        # Register event handlers
        wx.EVT_CLOSE(self, self.OnExit)
        wx.grid.EVT_GRID_CELL_LEFT_CLICK(self.grid, self.OnLeftClick)

        # Layout
        self.__Layout()

        # Start update thread
        self.updateThread = threading.Thread(target=self.ChangeValuesThread)
        self.updateThread.start()
Example #7
0
 def seturl(obj):
     obj.SetURL(self.app.url_server + obj.GetLabel())
     obj.SetToolTip(wx.ToolTip(obj.GetLabel()))
Example #8
0
 def __set_properties(self):
     self.radio_local.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour afficher les fichiers disponibles en mode local")))
     self.radio_reseau.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour afficher les fichiers disponibles en mode réseau")))
     self.ctrl_port.SetMinSize((40, -1))
     self.ctrl_port.SetToolTip(wx.ToolTip(_(u"Le numéro de port est 3306 par défaut")))
     self.ctrl_hote.SetMinSize((90,-1))
     self.ctrl_hote.SetToolTip(wx.ToolTip(_(u"Indiquez ici le nom du serveur hôte")))
     self.ctrl_utilisateur.SetMinSize((90,-1))
     self.ctrl_utilisateur.SetToolTip(wx.ToolTip(_(u"Indiquez ici le nom de l'utilisateur")))
     self.ctrl_motdepasse.SetToolTip(wx.ToolTip(_(u"Indiquez ici le mot de passe nécessaire à la connexion à MySQL")))
     self.bouton_valider_codes.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider les codes réseau et afficher la liste des fichiers disponibles")))
     self.bouton_importer_codes.SetToolTip(wx.ToolTip(_(u"Importer une configuration de fichier réseau")))
     self.bouton_exporter_codes.SetToolTip(wx.ToolTip(_(u"Exporter une configuration de fichier réseau")))
     self.bouton_modifier_fichier.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour modifier le nom du fichier sélectionné dans la liste")))
     self.bouton_supprimer_fichier.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour supprimer le fichier sélectionné dans la liste")))
     self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour ouvrir le fichier sélectionné dans la liste")))
     self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour annuler")))
Example #9
0
    def populatePanel(self, contentPanel, headerPanel):
        contentSizer = contentPanel.GetSizer()

        self.panel = contentPanel
        self.headerPanel = headerPanel
        sizerTankStats = wx.FlexGridSizer(3, 5)
        for i in range(4):
            sizerTankStats.AddGrowableCol(i + 1)

        contentSizer.Add(sizerTankStats, 0, wx.EXPAND, 0)

        # Add an empty label first for correct alignment.
        sizerTankStats.Add(wx.StaticText(contentPanel, wx.ID_ANY, ""), 0)
        toolTipText = {
            "shieldPassive": "Passive shield recharge",
            "shieldActive": "Active shield boost",
            "armorActive": "Armor repair amount",
            "hullActive": "Hull repair amount"
        }
        for tankType in ("shieldPassive", "shieldActive", "armorActive",
                         "hullActive"):
            bitmap = BitmapLoader.getStaticBitmap("%s_big" % tankType,
                                                  contentPanel, "gui")
            tooltip = wx.ToolTip(toolTipText[tankType])
            bitmap.SetToolTip(tooltip)
            sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)

        toolTipText = {"reinforced": "Reinforced", "sustained": "Sustained"}
        for stability in ("reinforced", "sustained"):
            bitmap = BitmapLoader.getStaticBitmap(
                "regen%s_big" % stability.capitalize(), contentPanel, "gui")
            tooltip = wx.ToolTip(toolTipText[stability])
            bitmap.SetToolTip(tooltip)
            sizerTankStats.Add(bitmap, 0, wx.ALIGN_CENTER)
            for tankType in ("shieldPassive", "shieldActive", "armorActive",
                             "hullActive"):
                if stability == "reinforced" and tankType == "shieldPassive":
                    sizerTankStats.Add(
                        wx.StaticText(contentPanel, wx.ID_ANY, ""))
                    continue

                tankTypeCap = tankType[0].capitalize() + tankType[1:]
                lbl = wx.StaticText(contentPanel,
                                    wx.ID_ANY,
                                    "0.0",
                                    style=wx.ALIGN_RIGHT)
                setattr(
                    self,
                    "labelTank%s%s" % (stability.capitalize(), tankTypeCap),
                    lbl)

                box = wx.BoxSizer(wx.HORIZONTAL)
                box.Add(lbl, 0, wx.EXPAND)

                unitlbl = wx.StaticText(contentPanel, wx.ID_ANY, " EHP/s")
                setattr(
                    self, "unitLabelTank%s%s" %
                    (stability.capitalize(), tankTypeCap), unitlbl)
                box.Add(unitlbl, 0, wx.EXPAND)

                sizerTankStats.Add(box, 0, wx.ALIGN_CENTRE)

        contentPanel.Layout()
Example #10
0
    def __init__(self,
                 parent,
                 overlay,
                 display,
                 displayCtx,
                 listBox,
                 showVis=True,
                 showGroup=True,
                 showSave=True,
                 propagateSelect=True):
        """Create a ``ListItemWidget``.

        :arg parent:          The :mod:`wx` parent object.
        :arg overlay:         The overlay associated with this
                              ``ListItemWidget``.
        :arg display:         The :class:`.Display` associated with the
                              overlay.
        :arg displayCtx:      The :class:`.DisplayContext` instance.
        :arg listBox:         The :class:`.EditableListBox` that contains this
                              ``ListItemWidget``.
        :arg showVis:         If ``True`` (the default), a button will be shown
                              allowing the user to toggle the overlay
                              visibility.
        :arg showGroup:       If ``True`` (the default), a button will be shown
                              allowing the user to toggle overlay grouping.
        :arg showSave:        If ``True`` (the default), a button will be shown
                              allowing the user to save the overlay (if it is
                              not saved).
        :arg propagateSelect: If ``True`` (the default), when an overlay is
                              selected in the list, the
                              :attr:`.DisplayContext.selectedOverlay` is
                              updated accordingly.
        """
        wx.Panel.__init__(self, parent)

        self.__overlay = overlay
        self.__display = display
        self.__displayCtx = displayCtx
        self.__listBox = listBox
        self.__propagateSelect = propagateSelect
        self.__name = '{}_{}'.format(self.__class__.__name__, id(self))
        self.__sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.SetSizer(self.__sizer)
        self.Bind(wx.EVT_WINDOW_DESTROY, self.__onDestroy)

        btnStyle = wx.BU_EXACTFIT | wx.BU_NOTEXT

        if showSave:
            self.__saveButton = wx.Button(self, style=btnStyle)
            self.__saveButton.SetBitmapLabel(icons.loadBitmap('floppydisk16'))
            self.__saveButton.SetToolTip(
                wx.ToolTip(fsltooltips.actions[self, 'save']))

            self.__sizer.Add(self.__saveButton, flag=wx.EXPAND, proportion=1)

            if isinstance(overlay, fslimage.Image):
                overlay.register(self.__name, self.__saveStateChanged,
                                 'saveState')
                self.__saveButton.Bind(wx.EVT_BUTTON, self.__onSaveButton)
            else:
                self.__saveButton.Enable(False)

            self.__saveStateChanged()

        if showGroup:
            self.__lockButton = bmptoggle.BitmapToggleButton(self,
                                                             style=btnStyle)

            self.__lockButton.SetBitmap(
                icons.loadBitmap('chainlinkHighlight16'),
                icons.loadBitmap('chainlink16'))

            self.__lockButton.SetToolTip(
                wx.ToolTip(fsltooltips.actions[self, 'group']))

            self.__sizer.Add(self.__lockButton, flag=wx.EXPAND, proportion=1)

            # There is currently only one overlay
            # group in the application. In the
            # future there may be multiple groups.
            group = displayCtx.overlayGroups[0]

            group.addListener('overlays', self.__name,
                              self.__overlayGroupChanged)

            self.__lockButton.Bind(wx.EVT_TOGGLEBUTTON, self.__onLockButton)
            self.__overlayGroupChanged()

        # Set up the show/hide button if needed
        if showVis:
            self.__visibility = bmptoggle.BitmapToggleButton(
                self,
                trueBmp=icons.loadBitmap('eyeHighlight16'),
                falseBmp=icons.loadBitmap('eye16'),
                style=btnStyle)

            self.__visibility.SetToolTip(
                wx.ToolTip(fsltooltips.properties[display, 'enabled']))

            self.__sizer.Add(self.__visibility, flag=wx.EXPAND, proportion=1)

            display.addListener('enabled', self.__name,
                                self.__displayVisChanged)

            self.__visibility.Bind(bmptoggle.EVT_BITMAP_TOGGLE,
                                   self.__onVisButton)

            self.__displayVisChanged()
Example #11
0
    def __init__(self, parent = None, ident = -1, title = ANAGAPOS):
        style = wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX

        wx.Frame.__init__(self, parent, ident, title, style = style)

        self.state = State()

        self.rule_set  = None
        self.rule_name = None
        self.signature = None

        # Create the radio buttons to select between lambda calculus and TRS.
        self.radio_lambda = wx.RadioButton(self, -1, 'lambda-calculus',
                                               style = wx.RB_GROUP)
        self.radio_trs = wx.RadioButton(self, -1, 'TRS')

        self.Bind(wx.EVT_RADIOBUTTON, self.SetRadioVal,
                      id = self.radio_lambda.GetId())
        self.Bind(wx.EVT_RADIOBUTTON, self.SetRadioVal,
                      id = self.radio_trs.GetId())

        radio_box = wx.BoxSizer(wx.HORIZONTAL)
        radio_box.Add(self.radio_lambda, 0, wx.ALIGN_LEFT, 10)
        radio_box.Add(self.radio_trs, 0, wx.ALIGN_LEFT | wx.LEFT, 10)

        self.radio_lambda.SetValue(True) # Lambda is by default active
        operation.set_mode("lambda")

        self.radio_lambda.SetToolTip(wx.ToolTip("lambda-beta-calculus"))
        self.radio_trs.SetToolTip(wx.ToolTip("Opens file dialog to select TRS"))

        self.active_rule_file_text \
            = wx.StaticText(self, -1, RULE_SET_TEXT + BETA_REDUCTION)

        # Sizes for the various buttons and text fields
        width         = 200
        spinner_width = 60
        button_size   = (width, -1)
        spinner_size  = (spinner_width, -1)
        step_size     = (width - spinner_width, -1)

        # Term text field
        self.term_input = wx.TextCtrl(self, 0, style = wx.TE_MULTILINE,
                                          size = (width, 100))
        self.term_input.Bind(wx.EVT_TEXT, self.TextChange)

        # Buttons
        draw_button     = wx.Button(self, 0, "Reset Graph", size = button_size)
        random_button   = wx.Button(self, 0, "Random Term", size = button_size)
        forward_button  = wx.Button(self, 0, "Forward", size = step_size)
        backward_button = wx.Button(self, 0, "Backward", size = step_size)

        self.start_checkbox = wx.CheckBox(self, -1, "Color initial term")
        self.new_checkbox   = wx.CheckBox(self, -1, "Color latest term")


        # Spinners (for choosing step size)
        self.forward_spinner = wx.SpinCtrl(self, -1, "1", min = 1, max = 999,
                                               initial = 1, size = spinner_size)
        forward_box = wx.BoxSizer(wx.HORIZONTAL)
        forward_box.Add(forward_button, 0,
                            wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 10)
        forward_box.Add(self.forward_spinner, 0,
                            wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10)
        self.backward_spinner = wx.SpinCtrl(self, -1, "1", min = 1, max = 999,
                                               initial = 1, size = spinner_size)
        backward_box = wx.BoxSizer(wx.HORIZONTAL)
        backward_box.Add(backward_button, 0,
                            wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 10)
        backward_box.Add(self.backward_spinner, 0,
                            wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL, 10)

        # Button/spinner actions
        draw_button.Bind(wx.EVT_BUTTON, self.ResetGraph)
        random_button.Bind(wx.EVT_BUTTON, self.Generate)
        forward_button.Bind(wx.EVT_BUTTON, self.Forward)
        backward_button.Bind(wx.EVT_BUTTON, self.Backward)
        self.start_checkbox.Bind(wx.EVT_CHECKBOX, self.StartCheck)
        self.new_checkbox.Bind(wx.EVT_CHECKBOX, self.NewCheck)

        # Status information
        self.disp_terms = wx.StaticText(self, -1, DISP_TERMS_TEXT + "-")
        self.disp_steps = wx.StaticText(self, -1, DISP_STEPS_TEXT + "-")

        # Layout the control panel
        bts = wx.BoxSizer(wx.VERTICAL)
        bts.Add(radio_box, 0, wx.ALIGN_LEFT | wx.ALL, 10)
        bts.Add(self.active_rule_file_text, 0, wx.ALIGN_LEFT | wx.LEFT, 10)
        bts.Add(self.term_input, 0, wx.ALIGN_CENTER | wx.ALL, 10)
        bts.Add(random_button, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3)
        bts.Add(draw_button, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3)
        bts.Add(forward_box, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3)
        bts.Add(backward_box, 0, wx.ALIGN_CENTER | wx.LEFT | wx.BOTTOM, 3)
        bts.Add(self.start_checkbox, 0, wx.ALIGN_LEFT | wx.LEFT, 10)
        bts.Add(self.new_checkbox, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10)
        bts.Add(self.disp_terms, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10)
        bts.Add(self.disp_steps, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 10)

        # Layout the whole window frame
        box = wx.BoxSizer(wx.HORIZONTAL)
        box.Add(bts, 0, wx.ALIGN_TOP, 15)

        self.SetAutoLayout(True)
        self.SetSizer(box)
        self.Layout()

        self.CreateStatusBar()

        # Menus
        filemenu = wx.Menu()

        # Menu actions
        menuitem = filemenu.Append(-1, "&Open Rule Set\tCtrl+O",
                                                          "Load TRS rule set")
        self.Bind(wx.EVT_MENU, self.OnLoadRuleSet, menuitem)

        filemenu.AppendSeparator()
        menuitem = filemenu.Append(wx.ID_ABOUT)
        self.Bind(wx.EVT_MENU, self.OnAbout, menuitem)
        menuitem = filemenu.Append(wx.ID_CLOSE)
        self.Bind(wx.EVT_MENU, self.OnExit, menuitem)

        # Menubar, containg the menu(s) created above
        menubar = wx.MenuBar()
        menubar.Append(filemenu, "&File")
        self.SetMenuBar(menubar)

        # Give window its proper size
        self.Fit()
 def __set_properties(self):
     self.bouton_valider.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider les paramètres de la recherche")))
     self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_fermer.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour fermer")))
Example #13
0
    def __init__(self,
                 parent,
                 id=wx.ID_ANY,
                 range=100,
                 pos=wx.DefaultPosition,
                 size=(-1, 30),
                 style=0):
        """
        Default class constructor.

        :param `parent`: parent window. Must not be ``None``;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform.
        """

        wx.PyWindow.__init__(self, parent, id, pos, size, style)

        self._size = size

        self._border_colour = wx.BLACK
        self._barColour = self._barColourSorted = [wx.Colour(212, 228, 255)]
        self._barGradient = self._barGradientSorted = None

        self._border_padding = 0
        self._range = range
        self._value = 0

        self._fractionDigits = 0

        self._timerId = wx.NewId()
        self._timer = None

        self._oldValue = 0

        self._animDuration = 500
        self._animStep = 0
        self._period = 20
        self._animValue = 0
        self._animDirection = 0
        self.animEffect = animEffects.OUT_QUAD

        self.transitionsColors = [
            (wx.Colour(191, 191, 191, 255), wx.Colour(96, 191, 0, 255)),
            (wx.Colour(191, 167, 96, 255), wx.Colour(255, 191, 0, 255)),
            (wx.Colour(255, 191, 0, 255), wx.Colour(255, 128, 0, 255)),
            (wx.Colour(255, 128, 0, 255), wx.Colour(255, 0, 0, 255))
        ]
        self.gradientEffect = -35

        self._percentage = 0
        self._oldPercentage = 0
        self._showRemaining = False

        self.font = wx.FontFromPixelSize((0, 14), wx.SWISS, wx.NORMAL,
                                         wx.NORMAL, False)

        self.SetBarGradient((wx.Colour(119, 119,
                                       119), wx.Colour(153, 153, 153)))
        self.SetBackgroundColour(wx.Colour(51, 51, 51))
        self._tooltip = wx.ToolTip("")
        self.SetToolTip(self._tooltip)
        self._tooltip.SetTip("0.00/100.00")

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnWindowEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnWindowLeave)
Example #14
0
	def __init__( self, parent, id=wx.ID_ANY, size=wx.DefaultSize ):
		super(Primes, self).__init__( parent, id, size=size )
		
		self.state = RaceInputState()
		
		vsOverall = wx.BoxSizer( wx.VERTICAL )
		
		#---------------------------------------------------------------
		self.colNameFields = (
			(_('Prime For'),			'effortType',	's'),
			(_('or Custom'),			'effortCustom',	's'),
			(_('Position'),				'position',		'i'),
			(_('Laps\nTo Go'),			'lapsToGo',		'i'),
			(_('Sponsor'),				'sponsor', 		's'),
			(_('Cash'),					'cash', 		'f'),
			(_('Merchandise'),			'merchandise', 	's'),
			(_('Points'),				'points', 		'i'),
			(_('Time\nBonus'),			'timeBonus', 	't'),
			(_('Winner\nBib'),			'winnerBib',	'i'),
			(u'',						'winnerInfo',	's'),
		)
		self.colnames = [colName for colName, fieldName, dataType in self.colNameFields]
		self.iCol = dict( (fieldName, i) for i, (colName, fieldName, dataType) in enumerate(self.colNameFields) if fieldName )
		self.grid = ReorderableGrid( self )
		self.grid.CreateGrid( 0, len(self.colNameFields) )
		GetTranslation = _
		for col, (colName, fieldName, dataType) in enumerate(self.colNameFields):
			self.grid.SetColLabelValue( col, colName )
			attr = wx.grid.GridCellAttr()
			if fieldName == 'effortType':
				attr.SetEditor( wx.grid.GridCellChoiceEditor(choices=[GetTranslation(name) for code, name in EffortChoices]) )
				attr.SetAlignment( wx.ALIGN_CENTRE, wx.ALIGN_TOP )
			elif fieldName == 'position':
				attr.SetAlignment( wx.ALIGN_CENTRE, wx.ALIGN_TOP )
			elif fieldName == 'winnerInfo':
				attr.SetReadOnly( True )
			elif dataType == 'i':
				attr.SetAlignment( wx.ALIGN_RIGHT, wx.ALIGN_TOP )
				attr.SetEditor( wx.grid.GridCellFloatEditor(precision=0) )
				attr.SetRenderer( wx.grid.GridCellFloatRenderer(precision=0) )
			elif dataType == 'f':
				attr.SetAlignment( wx.ALIGN_RIGHT, wx.ALIGN_TOP )
				attr.SetEditor( wx.grid.GridCellFloatEditor(precision=2) )
				attr.SetRenderer( wx.grid.GridCellFloatRenderer(precision=2) )
			elif dataType == 't':
				attr.SetAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
				attr.SetEditor( TimeEditor() )
			
			self.grid.SetColAttr( col, attr )
			if fieldName == 'lapsToGo':
				self.lapsToGoCol = col
		
		self.grid.Bind( wx.grid.EVT_GRID_CELL_CHANGED, self.onCellChange )
		self.grid.AutoSizeColumns( False )
		self.grid.AutoSizeRows( False )

		#---------------------------------------------------------------
		self.photosButton = wx.Button( self, label=u'{}...'.format(_('Photos')) )
		self.photosButton.Bind( wx.EVT_BUTTON, self.onPhotos )
		self.finishStrip = wx.Button( self, label=u'{}...'.format(_('Finish Strip')) )
		self.finishStrip.Bind( wx.EVT_BUTTON, self.onFinishStrip )
		self.history = wx.Button( self, label=u'{}...'.format(_('Passings')) )
		self.history.Bind( wx.EVT_BUTTON, self.onHistory )
		
		self.newButton = wx.Button( self, id=wx.ID_NEW )
		self.newButton.SetToolTip( wx.ToolTip(_('Create a new Prime')) )
		self.newButton.Bind( wx.EVT_BUTTON, self.onNew )
		self.nextPositionButton = wx.Button( self, label=('Next Position') )
		self.nextPositionButton.SetToolTip( wx.ToolTip(_('Create a Prime from an Existing Prime for the Next Position')) )
		self.nextPositionButton.Bind( wx.EVT_BUTTON, self.onNextPosition )
		self.nextPrimeButton = wx.Button( self, label=('Next Prime') )
		self.nextPrimeButton.SetToolTip( wx.ToolTip(_('Create a Prime from an Existing Prime')) )
		self.nextPrimeButton.Bind( wx.EVT_BUTTON, self.onNextPrime )
		self.deleteButton = wx.Button( self, id=wx.ID_DELETE )
		self.deleteButton.SetToolTip( wx.ToolTip(_('Delete a Prime')) )
		self.deleteButton.Bind( wx.EVT_BUTTON, self.onDelete )
		hsButtons = wx.BoxSizer( wx.HORIZONTAL )
		hsButtons.Add( self.photosButton, flag=wx.ALL, border=4 )
		hsButtons.Add( self.finishStrip, flag=wx.ALL, border=4 )
		hsButtons.Add( self.history, flag=wx.ALL, border=4 )
		hsButtons.AddStretchSpacer()
		hsButtons.Add( self.newButton, flag=wx.ALL, border=4 )
		hsButtons.Add( self.nextPositionButton, flag=wx.ALL, border=4 )
		hsButtons.Add( self.nextPrimeButton, flag=wx.ALL, border=4 )
		hsButtons.Add( self.deleteButton, flag=wx.ALL, border=4 )
		
		#---------------------------------------------------------------
		
		vsOverall.Add( self.grid, 1, flag=wx.EXPAND|wx.ALL, border=4 )
		vsOverall.Add( hsButtons, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=4 )
		self.SetSizer( vsOverall )
 def __set_properties(self):
     self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider")))
     self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour annuler")))
Example #16
0
 def __set_properties(self):
     self.SetTitle(_(u"Saisie et suppression par lot"))
     self.ctrl_date.SetToolTip(
         wx.ToolTip(
             _(u"Sélectionnez une date modèle. Les éléments de cette date seront copiés vers les dates cibles"
               )))
     self.radio_date.SetToolTip(
         wx.ToolTip(
             _(u"Sélectionnez ce mode pour copier les éléments d'une date donnée"
               )))
     self.radio_renitialisation.SetToolTip(
         wx.ToolTip(
             _(u"Sélectionnez ce mode pour réinitialiser les éléments des dates cibles"
               )))
     self.check_ouvertures.SetToolTip(
         wx.ToolTip(_(u"Cochez cette case pour modifier les ouvertures")))
     self.check_places.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case pour modifier les nbres de places max. (remplissage)"
               )))
     self.check_evenements.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case pour modifier les évènements (uniquement pour les unités de type évènementielles"
               )))
     self.ctrl_date_debut.SetToolTip(
         wx.ToolTip(
             _(u"Sélectionnez une date de début de période cible")))
     self.ctrl_date_fin.SetToolTip(
         wx.ToolTip(_(u"Sélectionnez une date de fin de période cible")))
     self.ctrl_feries.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case pour modifier également les jours fériés"
               )))
     self.bouton_aide.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider")))
     self.bouton_annuler.SetToolTip(
         wx.ToolTip(_(u"Cliquez ici pour annuler")))
Example #17
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        backgroud_colour = wx.Colour(255,255,255)
        self.SetBackgroundColour(backgroud_colour)
        self.SetAutoLayout(1)

        # Counter for projects loaded in current GUI

        # Fixed hyperlink items
        tooltip = wx.ToolTip(_("Export InVesalius screen to an image file"))
        link_export_picture = hl.HyperLinkCtrl(self, -1,
                                            _("Export picture..."))
        link_export_picture.SetUnderlines(False, False, False)
        link_export_picture.SetBold(True)
        link_export_picture.SetColours("BLACK", "BLACK", "BLACK")
        link_export_picture.SetBackgroundColour(self.GetBackgroundColour())
        link_export_picture.SetToolTip(tooltip)
        link_export_picture.AutoBrowse(False)
        link_export_picture.UpdateLink()
        link_export_picture.Bind(hl.EVT_HYPERLINK_LEFT,
                                 self.OnLinkExportPicture)

        tooltip = wx.ToolTip(_("Export 3D surface"))
        link_export_surface = hl.HyperLinkCtrl(self, -1,_("Export 3D surface..."))
        link_export_surface.SetUnderlines(False, False, False)
        link_export_surface.SetBold(True)
        link_export_surface.SetColours("BLACK", "BLACK", "BLACK")
        link_export_surface.SetBackgroundColour(self.GetBackgroundColour())
        link_export_surface.SetToolTip(tooltip)
        link_export_surface.AutoBrowse(False)
        link_export_surface.UpdateLink()
        link_export_surface.Bind(hl.EVT_HYPERLINK_LEFT,
                              self.OnLinkExportSurface)

        #tooltip = wx.ToolTip(_("Export 3D mask (voxels)"))
        #link_export_mask = hl.HyperLinkCtrl(self, -1,_("Export mask..."))
        #link_export_mask.SetUnderlines(False, False, False)
        #link_export_mask.SetColours("BLACK", "BLACK", "BLACK")
        #link_export_mask.SetToolTip(tooltip)
        #link_export_mask.AutoBrowse(False)
        #link_export_mask.UpdateLink()
        #link_export_mask.Bind(hl.EVT_HYPERLINK_LEFT,
        #                      self.OnLinkExportMask)


        #tooltip = wx.ToolTip("Request rapid prototyping services")
        #link_request_rp = hl.HyperLinkCtrl(self,-1,"Request rapid prototyping...")
        #link_request_rp.SetUnderlines(False, False, False)
        #link_request_rp.SetColours("BLACK", "BLACK", "BLACK")
        #link_request_rp.SetToolTip(tooltip)
        #link_request_rp.AutoBrowse(False)
        #link_request_rp.UpdateLink()
        #link_request_rp.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkRequestRP)

        #tooltip = wx.ToolTip("Open report tool...")
        #link_report = hl.HyperLinkCtrl(self,-1,"Open report tool...")
        #link_report.SetUnderlines(False, False, False)
        #link_report.SetColours("BLACK", "BLACK", "BLACK")
        #link_report.SetToolTip(tooltip)
        #link_report.AutoBrowse(False)
        #link_report.UpdateLink()
        #link_report.Bind(hl.EVT_HYPERLINK_LEFT, self.OnLinkReport)


        # Image(s) for buttons
        if sys.platform == 'darwin':
            BMP_EXPORT_SURFACE = wx.Bitmap(\
                                  os.path.join(inv_paths.ICON_DIR, "surface_export_original.png"),
                                  wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()
            BMP_TAKE_PICTURE = wx.Bitmap(\
                                 os.path.join(inv_paths.ICON_DIR, "tool_photo_original.png"),
                                 wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            #BMP_EXPORT_MASK = wx.Bitmap("../icons/mask.png",
            #                            wx.BITMAP_TYPE_PNG)
        else:
            BMP_EXPORT_SURFACE = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "surface_export.png"),
                                        wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            BMP_TAKE_PICTURE = wx.Bitmap(os.path.join(inv_paths.ICON_DIR, "tool_photo.png"),
                                     wx.BITMAP_TYPE_PNG).ConvertToImage()\
                                          .Rescale(25, 25).ConvertToBitmap()

            #BMP_EXPORT_MASK = wx.Bitmap("../icons/mask_small.png",
            #                            wx.BITMAP_TYPE_PNG)



        # Buttons related to hyperlinks
        button_style = pbtn.PB_STYLE_SQUARE | pbtn.PB_STYLE_DEFAULT

        button_picture = pbtn.PlateButton(self, BTN_PICTURE, "",
                                               BMP_TAKE_PICTURE,
                                               style=button_style)
        button_picture.SetBackgroundColour(self.GetBackgroundColour())
        self.button_picture = button_picture

        button_surface = pbtn.PlateButton(self, BTN_SURFACE, "",
                                                BMP_EXPORT_SURFACE,
                                              style=button_style)
        button_surface.SetBackgroundColour(self.GetBackgroundColour())
        #button_mask = pbtn.PlateButton(self, BTN_MASK, "",
        #                                BMP_EXPORT_MASK,
        #                                style=button_style)
        #button_request_rp = pbtn.PlateButton(self, BTN_REQUEST_RP, "",
        #                                    BMP_IMPORT, style=button_style)
        #button_report = pbtn.PlateButton(self, BTN_REPORT, "",
        #                                 BMP_IMPORT,
        #                                 style=button_style)

        # When using PlaneButton, it is necessary to bind events from parent win
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        # Tags and grid sizer for fixed items
        flag_link = wx.EXPAND|wx.GROW|wx.LEFT|wx.TOP
        flag_button = wx.EXPAND | wx.GROW

        fixed_sizer = wx.FlexGridSizer(rows=2, cols=2, hgap=2, vgap=0)
        fixed_sizer.AddGrowableCol(0, 1)
        fixed_sizer.AddMany([ (link_export_picture, 1, flag_link, 3),
                              (button_picture, 0, flag_button),
                              (link_export_surface, 1, flag_link, 3),
                              (button_surface, 0, flag_button),])
                              #(link_export_mask, 1, flag_link, 3),
                              #(button_mask, 0, flag_button)])
                              #(link_report, 0, flag_link, 3),
                              #(button_report, 0, flag_button),
                              #(link_request_rp, 1, flag_link, 3),
                              #(button_request_rp, 0, flag_button)])

        # Add line sizers into main sizer
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND)

        # Update main sizer and panel layout
        self.SetSizer(main_sizer)
        self.Fit()
        self.sizer = main_sizer
        self.__init_menu()
Example #18
0
    def init_dialog(self, config, pks, massdat=None):
        """
        Creates the dialog window and displays it.
        :param config: UniDecConfig object
        :param pks: Peaks object
        :param massdat: Mass distribution
        :return: None
        """
        # massbins = config.massbins
        self.massdat = massdat
        self.config = config
        self.pks = pks

        panel = DummyPanel(self)
        vbox = wx.BoxSizer(wx.VERTICAL)

        hbox = wx.BoxSizer(wx.HORIZONTAL)
        sb = wx.StaticBox(panel, label='Set the Mass List for Limited UniDec')
        sbs = wx.StaticBoxSizer(sb, orient=wx.VERTICAL)
        peakpop = wx.Button(panel, label="Populate from Peak List")
        self.Bind(wx.EVT_BUTTON, self.pop_from_peaks, peakpop)

        importbutton = wx.Button(panel, label="Import from File")
        self.Bind(wx.EVT_BUTTON, self.on_import_masses, importbutton)

        oligopop = wx.Button(panel, label="Populate from Isolated Oligomers")
        self.Bind(wx.EVT_BUTTON, self.pop_oligo_iso, oligopop)

        oligopop2 = wx.Button(panel,
                              label="Populate from All Possible Oligomers")
        self.Bind(wx.EVT_BUTTON, self.pop_oligo_all, oligopop2)

        clearbutt = wx.Button(panel, label="Clear List")
        self.Bind(wx.EVT_BUTTON, self.on_clear_masslist, clearbutt)

        addbutton = wx.Button(panel, label="Manual Add Species")
        self.Bind(wx.EVT_BUTTON, self.on_add_mass, addbutton)

        simbutton = wx.Button(panel, label="Simulate These Masses")
        self.Bind(wx.EVT_BUTTON, self.on_simulate, simbutton)

        sbs.Add(peakpop, 0, wx.EXPAND)
        sbs.Add(importbutton, 0, wx.EXPAND)
        sbs.Add(oligopop, 0, wx.EXPAND)
        sbs.Add(oligopop2, 0, wx.EXPAND)
        sbs.Add(addbutton, 0, wx.EXPAND)
        sbs.Add(clearbutt, 0, wx.EXPAND)
        self.masslistbox = MassListCtrlPanel(panel)

        sbs.Add(wx.StaticText(panel, label="Mass List"))
        sbs.Add(self.masslistbox)
        sbs.Add(simbutton, 0, wx.EXPAND)

        hbox.Add(sbs)

        sb2 = wx.StaticBox(panel, label='Oligomer Maker')
        sbs2 = wx.StaticBoxSizer(sb2, orient=wx.VERTICAL)

        clearbutt2 = wx.Button(panel, label="Clear Oligomer List")
        self.Bind(wx.EVT_BUTTON, self.on_clear_oligolist, clearbutt2)

        addbutton2 = wx.Button(panel, label="Add Oligomer Species")
        self.Bind(wx.EVT_BUTTON, self.on_add_oligomer, addbutton2)

        importbutton2 = wx.Button(panel, label="Import from File")
        self.Bind(wx.EVT_BUTTON, self.on_import_oligos, importbutton2)

        plotbutton = wx.Button(panel, label="View Autocorrelation Plot")
        self.Bind(wx.EVT_BUTTON, self.on_autocorr_window, plotbutton)
        buttonbox = wx.BoxSizer(wx.VERTICAL)
        hbox3 = wx.BoxSizer(wx.HORIZONTAL)
        buttonbox.Add(importbutton2, 0, wx.EXPAND)
        buttonbox.Add(addbutton2, 0, wx.EXPAND)
        buttonbox.Add(clearbutt2, 0, wx.EXPAND)
        buttonbox.Add(plotbutton, 0, wx.EXPAND)
        hbox3.Add(buttonbox)
        textbox = wx.BoxSizer(wx.VERTICAL)
        text = wx.StaticText(
            panel,
            label=
            "  For i from Min # to Max #:\n      Mass(i)=Base Offset + Monomer Mass * i \n"
        )
        font = wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL,
                       wx.FONTWEIGHT_BOLD, False)
        text.SetFont(font)
        textbox.Add(text)

        self.ctlmatcherror = wx.TextCtrl(panel,
                                         value=str(self.config.matchtolerance))
        textbox.Add(
            wx.StaticText(panel, label="Error Tolerance for Matching (Da)"), 0,
            wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
        textbox.Add(self.ctlmatcherror, 0, wx.ALIGN_RIGHT)

        hbox3.Add(textbox)
        sbs2.Add(hbox3, 0, wx.EXPAND)

        self.oligomerlistbox = OligomerListCrtlPanel(panel)

        sbs2.Add(wx.StaticText(panel, label="Oligomer List"))
        sbs2.Add(self.oligomerlistbox)
        sbs2.Add(wx.StaticText(panel, label=""))

        sb4 = wx.StaticBox(panel, label="Match Peaks to Oligomers")
        sbs4 = wx.StaticBoxSizer(sb4, orient=wx.VERTICAL)
        match_iso_button = wx.Button(panel,
                                     label="Match to Isolated Oligomers")
        match_iso_button.SetToolTip(
            wx.ToolTip(
                "Match peaks to isolated oligomers from Oligomer Maker."))
        self.Bind(wx.EVT_BUTTON, self.on_match_isolated, match_iso_button)
        match_all_button = wx.Button(panel, label="Matched to Mixed Oligomers")
        match_all_button.SetToolTip(
            wx.ToolTip(
                "Match peaks to any possible combination of oligomers from Oligomer Maker."
            ))
        self.Bind(wx.EVT_BUTTON, self.on_match_all, match_all_button)
        self.matchlistbox = MatchListCrtlPanel(panel)
        hbox2 = wx.BoxSizer(wx.HORIZONTAL)
        hbox2.Add(match_iso_button, 1, wx.EXPAND)
        hbox2.Add(match_all_button, 1, wx.EXPAND)
        sbs4.Add(hbox2, 0, wx.EXPAND)
        sbs4.Add(self.matchlistbox)
        sbs2.AddStretchSpacer(prop=1)
        sbs2.Add(sbs4)
        hbox.Add(sbs2)

        sb5 = wx.StaticBox(panel, label='Common Masses')
        sbs5 = wx.StaticBoxSizer(sb5, orient=wx.VERTICAL)

        importbutton2 = wx.Button(panel, label="Import from File")
        self.Bind(wx.EVT_BUTTON, self.on_load_common_masses, importbutton2)

        savecommonbutton = wx.Button(panel, label="Save Common Masses")
        self.Bind(wx.EVT_BUTTON, self.on_save_common_masses, savecommonbutton)

        addbutton4 = wx.Button(panel, label="Manual Add Species")
        self.Bind(wx.EVT_BUTTON, self.on_add_new_common_mass, addbutton4)

        sbs5.Add(importbutton2, 0, wx.EXPAND)
        sbs5.Add(savecommonbutton, 0, wx.EXPAND)
        sbs5.Add(addbutton4, 0, wx.EXPAND)
        self.commonmassespanel = CommonMassesPanel(panel)

        sbs5.Add(wx.StaticText(panel, label="Common Masses List"))
        sbs5.Add(self.commonmassespanel)

        hbox.Add(sbs5)

        panel.SetSizer(hbox)

        hboxend = wx.BoxSizer(wx.HORIZONTAL)
        okbutton = wx.Button(self, label='Ok')
        closebutton = wx.Button(self, label='Cancel')
        hboxend.Add(okbutton)
        hboxend.Add(closebutton, flag=wx.LEFT, border=5)

        vbox.Add(panel, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
        vbox.Add(hboxend, flag=wx.ALIGN_CENTER | wx.TOP | wx.BOTTOM, border=10)

        self.SetSizer(vbox)

        okbutton.Bind(wx.EVT_BUTTON, self.on_close)
        closebutton.Bind(wx.EVT_BUTTON, self.on_close_cancel)

        self.masslistbox.list.populate(self.config.masslist)
        self.oligomerlistbox.list.populate(self.config.oligomerlist)

        defaultmatchlist = self.config.matchlist
        if len(defaultmatchlist) == 4:
            self.matchlistbox.list.populate(defaultmatchlist[0],
                                            defaultmatchlist[1],
                                            defaultmatchlist[2],
                                            defaultmatchlist[3])
        try:
            self.load_common_masses(self.config.masstablefile)
        except:
            print "Unable to load common masses"
        self.CenterOnParent()
Example #19
0
    def __init__(self, parent, log):

        scrolled.ScrolledPanel.__init__(self, parent)

        self.log = log

        mainSz = wx.BoxSizer(wx.VERTICAL)

        horSz0 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add((0, 3))
        mainSz.Add(horSz0, 1, wx.EXPAND | wx.BOTTOM, 7)

        sampleList = [" ToasterBox TB_SIMPLE ", " ToasterBox TB_COMPLEX "]
        rb = wx.RadioBox(self, -1, "ToasterBox Style", wx.DefaultPosition,
                         wx.DefaultSize, sampleList, 2, wx.RA_SPECIFY_COLS)

        horSz0.Add(rb, 1, 0, 5)
        rb.SetToolTip(wx.ToolTip("Choose the ToasterBox style"))

        self.radiochoice = rb

        horSz1 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz1, 1, wx.EXPAND | wx.ALL, 5)

        statTxt1 = wx.StaticText(self, -1, "Popup position x/y")
        horSz1.Add(statTxt1, 3)
        txtCtrl1 = wx.TextCtrl(self, -1, "500")
        horSz1.Add(txtCtrl1, 1)
        txtCtrl1b = wx.TextCtrl(self, -1, "500")
        horSz1.Add(txtCtrl1b, 1)

        self.posx = txtCtrl1
        self.posy = txtCtrl1b

        horSz2 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz2, 1, wx.EXPAND | wx.ALL, 5)

        statTxt2 = wx.StaticText(self, -1, "Popup size x/y")
        horSz2.Add(statTxt2, 3)
        txtCtrl2 = wx.TextCtrl(self, -1, "210")
        horSz2.Add(txtCtrl2, 1)
        txtCtrl3 = wx.TextCtrl(self, -1, "130")
        horSz2.Add(txtCtrl3, 1)

        self.sizex = txtCtrl2
        self.sizey = txtCtrl3

        horSz3 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz3, 1, wx.EXPAND | wx.ALL, 5)

        statTxt3 = wx.StaticText(self, -1, "Popup linger")
        horSz3.Add(statTxt3, 3)
        txtCtrl4 = wx.TextCtrl(self, -1, "4000")
        helpstr = "How long the popup will stay\naround after it is launched"
        txtCtrl4.SetToolTip(wx.ToolTip(helpstr))
        horSz3.Add(txtCtrl4, 1)

        self.linger = txtCtrl4

        horSz3b = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz3b, 1, wx.EXPAND | wx.ALL, 5)
        statTxt3b = wx.StaticText(self, -1, "Popup scroll speed")
        horSz3b.Add(statTxt3b, 3)
        txtCtrl4b = wx.TextCtrl(self, -1, "8")
        helpstr = "How long it takes the window to \"fade\" in and out"
        txtCtrl4b.SetToolTip(wx.ToolTip(helpstr))
        horSz3b.Add(txtCtrl4b, 2)

        self.scrollspeed = txtCtrl4b

        horSz3c = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz3c, 1, wx.EXPAND | wx.ALL, 5)
        statTxt3c = wx.StaticText(self, -1, "Popup background picture")
        horSz3c.Add(statTxt3c, 3)
        txtCtrl4c = wx.FilePickerCtrl(self,
                                      -1,
                                      style=wx.FLP_USE_TEXTCTRL | wx.FLP_OPEN)
        horSz3c.Add(txtCtrl4c, 2)

        self.backimage = txtCtrl4c

        popupText1 = "Hello from wxPython! This is another (probably) useful class. " \
                     "written by Andrea Gavana @ 8 September 2005."
        popupText2 = "I don't know what to write in this message. If you like this " \
                     "class, please let me know!."

        horSz4 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz4, 1, wx.EXPAND | wx.ALL, 5)
        statTxt4 = wx.StaticText(self, -1, "Popup text")
        horSz4.Add(statTxt4, 1)
        txtCtrl5 = wx.TextCtrl(self, -1, popupText1)
        horSz4.Add(txtCtrl5, 2)

        self.showntext = txtCtrl5
        self.popupText1 = popupText1
        self.popupText2 = popupText2
        self.counter = 0

        horSz5 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz5, 1, wx.EXPAND | wx.ALL, 5)
        self.colButton1 = wx.Button(self, -1, "Set BG Colour")
        self.colButton1.SetToolTip(
            wx.ToolTip("Set the ToasterBox background colour"))
        self.colButton1.Bind(wx.EVT_BUTTON, self.SetColours)
        horSz5.Add(self.colButton1, 1, 0, 5)
        self.colButton2 = wx.Button(self, -1, "Set FG Colour")
        self.colButton2.SetToolTip(
            wx.ToolTip("Set the ToasterBox text colour"))
        self.colButton2.Bind(wx.EVT_BUTTON, self.SetColours2)
        horSz5.Add(self.colButton2, 1, 0, 5)

        horSz6 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz6, 1, wx.EXPAND | wx.ALL, 5)
        statTxt6 = wx.StaticText(self, -1, "Popup text font")
        horSz6.Add(statTxt6, 1, 0, 5)
        fontbutton = wx.Button(self, -1, "Select font")
        horSz6.Add(fontbutton, 1, 0, 5)

        horSz7 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz7, 1, wx.EXPAND | wx.ALL, 5)
        self.checkcaption = wx.CheckBox(self, -1, "Show with caption")
        horSz7.Add(self.checkcaption, 1, 0, 5)
        self.captiontext = wx.TextCtrl(self, -1, "ToasterBox title!")
        horSz7.Add(self.captiontext, 1, 0, 5)
        self.captiontext.Enable(False)
        self.checkcaption.Bind(wx.EVT_CHECKBOX, self.OnCheckCaption)

        horSz8 = wx.BoxSizer(wx.VERTICAL)
        mainSz.Add(horSz8, 1, wx.EXPAND | wx.ALL, 5)
        self.radiotime = wx.RadioButton(self,
                                        -1,
                                        "Hide by time",
                                        style=wx.RB_GROUP)
        horSz8.Add(self.radiotime, 1, 0, 5)
        self.radioclick = wx.RadioButton(self, -1, "Hide by click")
        horSz8.Add(self.radioclick, 1, 0, 5)

        horSz9 = wx.BoxSizer(wx.HORIZONTAL)
        mainSz.Add(horSz9, 1, wx.EXPAND | wx.ALL, 5)
        goButton = wx.Button(self, -1, "Show ToasterBox!")
        goButton.SetToolTip(
            wx.ToolTip("Launch ToasterBox. You can click more than once!"))
        horSz9.Add((1, 0), 1)
        horSz9.Add(goButton, 2, 0, 5)
        horSz9.Add((1, 0), 1)

        self.colButton1.SetBackgroundColour(wx.WHITE)
        self.colButton2.SetBackgroundColour(wx.BLACK)
        self.colButton2.SetForegroundColour(wx.WHITE)

        goButton.Bind(wx.EVT_BUTTON, self.ButtonDown)
        fontbutton.Bind(wx.EVT_BUTTON, self.OnSelectFont)
        rb.Bind(wx.EVT_RADIOBOX, self.OnRadioBox)

        self.curFont = self.GetFont()

        self.SetAutoLayout(True)
        self.SetSizer(mainSz)
        self.Fit()
        self.SetupScrolling()
Example #20
0
 def __set_properties(self):
     self.bouton_aide.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour obtenir de l'aide")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour transférer les locations vers l'éditeur d'Emails")))
     self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour annuler")))
     self.SetMinSize((850, 700))
Example #21
0
def add_extra_controls(self,
                       root,
                       parentpanel,
                       extra_buttons=None,
                       mini_mode=False):
    standalone_mode = extra_buttons is not None
    base_line = 1 if standalone_mode else 2

    if standalone_mode:
        gauges_base_line = base_line + 10
    elif mini_mode and root.display_graph:
        gauges_base_line = base_line + 6
    else:
        gauges_base_line = base_line + 5
    tempdisp_line = gauges_base_line + (2 if root.display_gauges else 0)
    if mini_mode and root.display_graph:
        e_base_line = base_line + 3
    else:
        e_base_line = base_line + 2

    pos_mapping = {
        "htemp_label": (base_line + 0, 0),
        "htemp_off": (base_line + 0, 2),
        "htemp_val": (base_line + 0, 3),
        "htemp_set": (base_line + 0, 4),
        "btemp_label": (base_line + 1, 0),
        "btemp_off": (base_line + 1, 2),
        "btemp_val": (base_line + 1, 3),
        "btemp_set": (base_line + 1, 4),
        "ebuttons": (e_base_line + 0, 0),
        "esettings": (e_base_line + 1, 0),
        "speedcontrol": (e_base_line + 2, 0),
        "htemp_gauge": (gauges_base_line + 0, 0),
        "btemp_gauge": (gauges_base_line + 1, 0),
        "tempdisp": (tempdisp_line, 0),
        "extrude": (3, 0),
        "reverse": (3, 2),
    }

    span_mapping = {
        "htemp_label": (1, 2),
        "htemp_off": (1, 1),
        "htemp_val": (1, 1),
        "htemp_set": (1, 1 if root.display_graph else 2),
        "btemp_label": (1, 2),
        "btemp_off": (1, 1),
        "btemp_val": (1, 1),
        "btemp_set": (1, 1 if root.display_graph else 2),
        "ebuttons": (1, 5 if root.display_graph else 6),
        "esettings": (1, 5 if root.display_graph else 6),
        "speedcontrol": (1, 5 if root.display_graph else 6),
        "htemp_gauge": (1, 5 if mini_mode else 6),
        "btemp_gauge": (1, 5 if mini_mode else 6),
        "tempdisp": (1, 5 if mini_mode else 6),
        "extrude": (1, 2),
        "reverse": (1, 3),
    }

    if standalone_mode:
        pos_mapping["tempgraph"] = (base_line + 5, 0)
        span_mapping["tempgraph"] = (5, 6)
    elif mini_mode:
        pos_mapping["tempgraph"] = (base_line + 2, 0)
        span_mapping["tempgraph"] = (1, 5)
    else:
        pos_mapping["tempgraph"] = (base_line + 0, 5)
        span_mapping["tempgraph"] = (5, 1)

    if mini_mode:
        pos_mapping["etool_label"] = (0, 0)
        pos_mapping["etool_val"] = (0, 1)
        pos_mapping["edist_label"] = (0, 2)
        pos_mapping["edist_val"] = (0, 3)
        pos_mapping["edist_unit"] = (0, 4)
    else:
        pos_mapping["edist_label"] = (0, 0)
        pos_mapping["edist_val"] = (1, 0)
        pos_mapping["edist_unit"] = (1, 1)
        pos_mapping["efeed_label"] = (0, 2)
        pos_mapping["efeed_val"] = (1, 2)
        pos_mapping["efeed_unit"] = (1, 3)

    def add(name, widget, *args, **kwargs):
        kwargs["pos"] = pos_mapping[name]
        if name in span_mapping:
            kwargs["span"] = span_mapping[name]
        if "container" in kwargs:
            container = kwargs["container"]
            del kwargs["container"]
        else:
            container = self
        container.Add(widget, *args, **kwargs)

    # Hotend & bed temperatures #

    # Hotend temp
    add("htemp_label",
        wx.StaticText(parentpanel, -1, _("Heat:")),
        flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
    htemp_choices = [
        root.temps[i] + " (" + i + ")"
        for i in sorted(root.temps.keys(), key=lambda x: root.temps[x])
    ]

    root.settoff = make_button(parentpanel,
                               _("Off"),
                               lambda e: root.do_settemp("off"),
                               _("Switch Hotend Off"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.settoff)
    add("htemp_off", root.settoff)

    if root.settings.last_temperature not in map(float, root.temps.values()):
        htemp_choices = [str(root.settings.last_temperature)] + htemp_choices
    root.htemp = wx.ComboBox(parentpanel,
                             -1,
                             choices=htemp_choices,
                             style=wx.CB_DROPDOWN,
                             size=(80, -1))
    root.htemp.SetToolTip(wx.ToolTip(_("Select Temperature for Hotend")))
    root.htemp.Bind(wx.EVT_COMBOBOX, root.htemp_change)

    add("htemp_val", root.htemp)
    root.settbtn = make_button(parentpanel,
                               _("Set"),
                               root.do_settemp,
                               _("Switch Hotend On"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.settbtn)
    add("htemp_set", root.settbtn, flag=wx.EXPAND)

    # Bed temp
    add("btemp_label",
        wx.StaticText(parentpanel, -1, _("Bed:")),
        flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
    btemp_choices = [
        root.bedtemps[i] + " (" + i + ")"
        for i in sorted(root.bedtemps.keys(), key=lambda x: root.temps[x])
    ]

    root.setboff = make_button(parentpanel,
                               _("Off"),
                               lambda e: root.do_bedtemp("off"),
                               _("Switch Heated Bed Off"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.setboff)
    add("btemp_off", root.setboff)

    if root.settings.last_bed_temperature not in map(float,
                                                     root.bedtemps.values()):
        btemp_choices = [str(root.settings.last_bed_temperature)
                         ] + btemp_choices
    root.btemp = wx.ComboBox(parentpanel,
                             -1,
                             choices=btemp_choices,
                             style=wx.CB_DROPDOWN,
                             size=(80, -1))
    root.btemp.SetToolTip(wx.ToolTip(_("Select Temperature for Heated Bed")))
    root.btemp.Bind(wx.EVT_COMBOBOX, root.btemp_change)
    add("btemp_val", root.btemp)

    root.setbbtn = make_button(parentpanel,
                               _("Set"),
                               root.do_bedtemp,
                               _("Switch Heated Bed On"),
                               size=(38, -1),
                               style=wx.BU_EXACTFIT)
    root.printerControls.append(root.setbbtn)
    add("btemp_set", root.setbbtn, flag=wx.EXPAND)

    root.btemp.SetValue(str(root.settings.last_bed_temperature))
    root.htemp.SetValue(str(root.settings.last_temperature))

    # added for an error where only the bed would get (pla) or (abs).
    # This ensures, if last temp is a default pla or abs, it will be marked so.
    # if it is not, then a (user) remark is added. This denotes a manual entry

    for i in btemp_choices:
        if i.split()[0] == str(root.settings.last_bed_temperature).split(
                '.')[0] or i.split()[0] == str(
                    root.settings.last_bed_temperature):
            root.btemp.SetValue(i)
    for i in htemp_choices:
        if i.split()[0] == str(root.settings.last_temperature).split(
                '.')[0] or i.split()[0] == str(root.settings.last_temperature):
            root.htemp.SetValue(i)

    if '(' not in root.btemp.Value:
        root.btemp.SetValue(root.btemp.Value + ' (user)')
    if '(' not in root.htemp.Value:
        root.htemp.SetValue(root.htemp.Value + ' (user)')

    # Speed control #
    speedpanel = root.newPanel(parentpanel)
    speedsizer = wx.BoxSizer(wx.HORIZONTAL)
    speedsizer.Add(wx.StaticText(speedpanel, -1, _("Print speed:")),
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)

    root.speed_slider = wx.Slider(speedpanel, -1, 100, 1, 300)
    speedsizer.Add(root.speed_slider, 1, flag=wx.EXPAND)

    root.speed_spin = FloatSpin(speedpanel,
                                -1,
                                value=100,
                                min_val=1,
                                max_val=300,
                                digits=0,
                                style=wx.ALIGN_LEFT,
                                size=(80, -1))
    speedsizer.Add(root.speed_spin, 0, flag=wx.ALIGN_CENTER_VERTICAL)
    root.speed_label = wx.StaticText(speedpanel, -1, _("%"))
    speedsizer.Add(root.speed_label,
                   flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)

    def speedslider_set(event):
        root.do_setspeed()
        root.speed_setbtn.SetBackgroundColour(wx.NullColour)

    root.speed_setbtn = make_button(speedpanel,
                                    _("Set"),
                                    speedslider_set,
                                    _("Set print speed factor"),
                                    size=(38, -1),
                                    style=wx.BU_EXACTFIT)
    root.printerControls.append(root.speed_setbtn)
    speedsizer.Add(root.speed_setbtn, flag=wx.ALIGN_CENTER)
    speedpanel.SetSizer(speedsizer)
    add("speedcontrol", speedpanel, flag=wx.EXPAND)

    def speedslider_spin(event):
        value = root.speed_spin.GetValue()
        root.speed_setbtn.SetBackgroundColour("red")
        root.speed_slider.SetValue(value)

    root.speed_spin.Bind(wx.EVT_SPINCTRL, speedslider_spin)

    def speedslider_scroll(event):
        value = root.speed_slider.GetValue()
        root.speed_setbtn.SetBackgroundColour("red")
        root.speed_spin.SetValue(value)

    root.speed_slider.Bind(wx.EVT_SCROLL, speedslider_scroll)

    # Temperature gauges #

    if root.display_gauges:
        root.hottgauge = TempGauge(parentpanel,
                                   size=(-1, 24),
                                   title=_("Heater:"),
                                   maxval=300,
                                   bgcolor=root.bgcolor)
        add("htemp_gauge", root.hottgauge, flag=wx.EXPAND)
        root.bedtgauge = TempGauge(parentpanel,
                                   size=(-1, 24),
                                   title=_("Bed:"),
                                   maxval=150,
                                   bgcolor=root.bgcolor)
        add("btemp_gauge", root.bedtgauge, flag=wx.EXPAND)

        def hotendgauge_scroll_setpoint(e):
            rot = e.GetWheelRotation()
            if rot > 0:
                root.do_settemp(str(root.hsetpoint + 1))
            elif rot < 0:
                root.do_settemp(str(max(0, root.hsetpoint - 1)))

        def bedgauge_scroll_setpoint(e):
            rot = e.GetWheelRotation()
            if rot > 0:
                root.do_settemp(str(root.bsetpoint + 1))
            elif rot < 0:
                root.do_settemp(str(max(0, root.bsetpoint - 1)))

        root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotendgauge_scroll_setpoint)
        root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bedgauge_scroll_setpoint)

    # Temperature (M105) feedback display #
    root.tempdisp = wx.StaticText(parentpanel,
                                  -1,
                                  "",
                                  style=wx.ST_NO_AUTORESIZE)

    def on_tempdisp_size(evt):
        root.tempdisp.Wrap(root.tempdisp.GetSize().width)

    root.tempdisp.Bind(wx.EVT_SIZE, on_tempdisp_size)

    def tempdisp_setlabel(label):
        wx.StaticText.SetLabel(root.tempdisp, label)
        root.tempdisp.Wrap(root.tempdisp.GetSize().width)
        root.tempdisp.SetSize((-1, root.tempdisp.GetBestSize().height))

    root.tempdisp.SetLabel = tempdisp_setlabel
    add("tempdisp", root.tempdisp, flag=wx.EXPAND)

    # Temperature graph #

    if root.display_graph:
        root.graph = Graph(parentpanel, wx.ID_ANY, root)
        add("tempgraph", root.graph, flag=wx.EXPAND | wx.ALL, border=5)
        root.graph.Bind(wx.EVT_LEFT_DOWN, root.graph.show_graph_window)

    # Extrusion controls #

    # Extrusion settings
    esettingspanel = root.newPanel(parentpanel)
    esettingssizer = wx.GridBagSizer()
    esettingssizer.SetEmptyCellSize((0, 0))
    root.edist = FloatSpin(esettingspanel,
                           -1,
                           value=root.settings.last_extrusion,
                           min_val=0,
                           max_val=1000,
                           size=(90, -1),
                           digits=1)
    root.edist.SetBackgroundColour((225, 200, 200))
    root.edist.SetForegroundColour("black")
    root.edist.Bind(wx.EVT_SPINCTRL, root.setfeeds)
    root.edist.Bind(wx.EVT_TEXT, root.setfeeds)
    add("edist_label",
        wx.StaticText(esettingspanel, -1, _("Length:")),
        container=esettingssizer,
        flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT,
        border=5)
    add("edist_val",
        root.edist,
        container=esettingssizer,
        flag=wx.ALIGN_CENTER | wx.RIGHT,
        border=5)
    unit_label = _("mm") if mini_mode else _("mm @")
    add("edist_unit",
        wx.StaticText(esettingspanel, -1, unit_label),
        container=esettingssizer,
        flag=wx.ALIGN_CENTER | wx.RIGHT,
        border=5)
    root.edist.SetToolTip(wx.ToolTip(_("Amount to Extrude or Retract (mm)")))
    if not mini_mode:
        root.efeedc = FloatSpin(esettingspanel,
                                -1,
                                value=root.settings.e_feedrate,
                                min_val=0,
                                max_val=50000,
                                size=(90, -1),
                                digits=1)
        root.efeedc.SetToolTip(
            wx.ToolTip(_("Extrude / Retract speed (mm/min)")))
        root.efeedc.SetBackgroundColour((225, 200, 200))
        root.efeedc.SetForegroundColour("black")
        root.efeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
        root.efeedc.Bind(wx.EVT_TEXT, root.setfeeds)
        add("efeed_val",
            root.efeedc,
            container=esettingssizer,
            flag=wx.ALIGN_CENTER | wx.RIGHT,
            border=5)
        add("efeed_label",
            wx.StaticText(esettingspanel, -1, _("Speed:")),
            container=esettingssizer,
            flag=wx.ALIGN_LEFT)
        add("efeed_unit",
            wx.StaticText(esettingspanel, -1, _("mm/\nmin")),
            container=esettingssizer,
            flag=wx.ALIGN_CENTER)
    else:
        root.efeedc = None
    esettingspanel.SetSizer(esettingssizer)
    add("esettings", esettingspanel, flag=wx.ALIGN_LEFT)

    if not standalone_mode:
        ebuttonspanel = root.newPanel(parentpanel)
        ebuttonssizer = wx.BoxSizer(wx.HORIZONTAL)
        if root.settings.extruders > 1:
            etool_sel_panel = esettingspanel if mini_mode else ebuttonspanel
            etool_label = wx.StaticText(etool_sel_panel, -1, _("Tool:"))
            if root.settings.extruders == 2:
                root.extrudersel = wx.Button(etool_sel_panel,
                                             -1,
                                             "0",
                                             style=wx.BU_EXACTFIT)
                root.extrudersel.SetToolTip(
                    wx.ToolTip(_("Click to switch current extruder")))

                def extrudersel_cb(event):
                    if root.extrudersel.GetLabel() == "1":
                        new = "0"
                    else:
                        new = "1"
                    root.extrudersel.SetLabel(new)
                    root.tool_change(event)

                root.extrudersel.Bind(wx.EVT_BUTTON, extrudersel_cb)
                root.extrudersel.GetValue = root.extrudersel.GetLabel
                root.extrudersel.SetValue = root.extrudersel.SetLabel
            else:
                choices = [str(i) for i in range(0, root.settings.extruders)]
                root.extrudersel = wx.ComboBox(etool_sel_panel,
                                               -1,
                                               choices=choices,
                                               style=wx.CB_DROPDOWN
                                               | wx.CB_READONLY,
                                               size=(50, -1))
                root.extrudersel.SetToolTip(
                    wx.ToolTip(_("Select current extruder")))
                root.extrudersel.SetValue(choices[0])
                root.extrudersel.Bind(wx.EVT_COMBOBOX, root.tool_change)
            root.printerControls.append(root.extrudersel)
            if mini_mode:
                add("etool_label",
                    etool_label,
                    container=esettingssizer,
                    flag=wx.ALIGN_CENTER)
                add("etool_val", root.extrudersel, container=esettingssizer)
            else:
                ebuttonssizer.Add(etool_label, flag=wx.ALIGN_CENTER)
                ebuttonssizer.Add(root.extrudersel)

        for key in ["extrude", "reverse"]:
            desc = root.cpbuttons[key]
            btn = make_custom_button(root,
                                     ebuttonspanel,
                                     desc,
                                     style=wx.BU_EXACTFIT)
            ebuttonssizer.Add(btn, 1, flag=wx.EXPAND)

        ebuttonspanel.SetSizer(ebuttonssizer)
        add("ebuttons", ebuttonspanel, flag=wx.EXPAND)
    else:
        for key, btn in extra_buttons.items():
            add(key, btn, flag=wx.EXPAND)
Example #22
0
 def CreationCaseJours(self, periode="scolaire"):
     for jour in self.liste_jours:
         setattr(self, "check_%s_%s" % (periode, jour),
                 wx.CheckBox(self, -1, jour[0].upper()))
         getattr(self, "check_%s_%s" % (periode, jour)).SetToolTip(
             wx.ToolTip(jour.capitalize()))
Example #23
0
    def make_standard(self, root, parentpanel, standalone_mode):
        lltspanel = root.newPanel(parentpanel)
        llts = wx.BoxSizer(wx.HORIZONTAL)
        lltspanel.SetSizer(llts)
        self.Add(lltspanel, pos=(0, 0), span=(1, 6))
        xyzpanel = root.newPanel(parentpanel)
        self.xyzsizer = XYZControlsSizer(root, xyzpanel)
        xyzpanel.SetSizer(self.xyzsizer)
        self.Add(xyzpanel, pos=(1, 0), span=(1, 6), flag=wx.ALIGN_CENTER)

        self.extra_buttons = {}
        pos_mapping = {
            "extrude": (4, 0),
            "reverse": (4, 2),
        }
        span_mapping = {
            "extrude": (1, 2),
            "reverse": (1, 3),
        }
        for key, desc in root.cpbuttons.items():
            if not standalone_mode and key in ["extrude", "reverse"]:
                continue
            panel = lltspanel if key == "motorsoff" else parentpanel
            btn = make_custom_button(root, panel, desc)
            if key == "motorsoff":
                llts.Add(btn)
            elif not standalone_mode:
                self.Add(btn,
                         pos=pos_mapping[key],
                         span=span_mapping[key],
                         flag=wx.EXPAND)
            else:
                self.extra_buttons[key] = btn

        root.xyfeedc = wx.SpinCtrl(lltspanel,
                                   -1,
                                   str(root.settings.xy_feedrate),
                                   min=0,
                                   max=50000,
                                   size=(97, -1))
        root.xyfeedc.SetToolTip(
            wx.ToolTip(_("Set Maximum Speed for X & Y axes (mm/min)")))
        llts.Add(wx.StaticText(lltspanel, -1, _("XY:")),
                 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        llts.Add(root.xyfeedc)
        llts.Add(wx.StaticText(lltspanel, -1, _("mm/min Z:")),
                 flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        root.zfeedc = wx.SpinCtrl(lltspanel,
                                  -1,
                                  str(root.settings.z_feedrate),
                                  min=0,
                                  max=50000,
                                  size=(90, -1))
        root.zfeedc.SetToolTip(
            wx.ToolTip(_("Set Maximum Speed for Z axis (mm/min)")))
        llts.Add(root.zfeedc, )

        root.xyfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
        root.zfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
        root.xyfeedc.Bind(wx.EVT_TEXT, root.setfeeds)
        root.zfeedc.Bind(wx.EVT_TEXT, root.setfeeds)
        root.zfeedc.SetBackgroundColour((180, 255, 180))
        root.zfeedc.SetForegroundColour("black")

        if not standalone_mode:
            add_extra_controls(self, root, parentpanel, None)
Example #24
0
 def __set_properties(self):
     self.check.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case si vous souhaitez appliquer un filtre sur les activités"
               )))
Example #25
0
    def __init__(self, parent, id, title, filename, dm):

        self.dm = dm
        self.fileNameTmp = filename

        wx.Frame.__init__(self, parent, -1, title, size=reportWindowSize)

        if platform != "darwin":
            icon = wx.Icon("LogoIcon.ico", wx.BITMAP_TYPE_ICO)
            self.SetIcon(icon)

        self.panel = wx.Panel(self)
        self.Bind(wx.EVT_CLOSE, self.OnEnd)
        self.WindowParent = parent

        vbox = wx.BoxSizer(wx.VERTICAL)

        htmlwin = wx.html.HtmlWindow(self.panel, -1, style=wx.NO_BORDER)
        #htmlwin.SetBackgroundColour(wx.RED)
        htmlwin.SetStandardFonts()
        htmlwin.LoadFile(self.fileNameTmp)

        vbox.Add(htmlwin, 1, wx.LEFT | wx.TOP | wx.GROW)

        # Box sizer for buttons

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        self.saveButton = wx.Button(self.panel,
                                    -1,
                                    "Save as HTML...",
                                    size=buttonSizeReportWindow)
        self.Bind(wx.EVT_BUTTON, self.OnSave, id=self.saveButton.GetId())
        self.saveButton.SetToolTip(wx.ToolTip("Click to generate html report"))
        hbox.Add(self.saveButton,
                 0,
                 border=borderSmall,
                 flag=wx.ALIGN_LEFT | wx.ALL)

        self.browserButton = wx.Button(self.panel,
                                       -1,
                                       "Open in browser",
                                       size=buttonSizeReportWindow)
        self.Bind(wx.EVT_BUTTON, self.OnBrowser, id=self.browserButton.GetId())
        self.browserButton.SetToolTip(
            wx.ToolTip("Click to open report in system's browser"))
        hbox.Add(self.browserButton,
                 0,
                 border=borderSmall,
                 flag=wx.ALIGN_LEFT | wx.ALL)

        hbox.AddStretchSpacer(1)

        self.endButton = wx.Button(self.panel,
                                   -1,
                                   "End",
                                   size=buttonSizeReportWindow)
        self.Bind(wx.EVT_BUTTON, self.OnEnd, id=self.endButton.GetId())
        self.endButton.SetToolTip(wx.ToolTip("Click to close window"))

        hbox.Add(self.endButton,
                 0,
                 border=borderSmall,
                 flag=wx.ALIGN_RIGHT | wx.ALL)

        vbox.Add(hbox, 0, flag=wx.EXPAND | wx.ALL, border=borderBig)

        self.panel.SetSizer(vbox)
        self.Centre()
        self.Show(True)

        self.SetMinSize(reportWindowMinSize)
Example #26
0
 def __set_properties(self):
     self.check.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case si vous souhaitez appliquer un filtre sur l'heure de badgeage"
               )))
Example #27
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL)
        self.parent = parent

        # Contrôles
        self.label_intro = wx.StaticText(
            self, -1, _(u"Cochez les informations à afficher :"))
        self.check_infos_medicales = wx.CheckBox(
            self, -1, _(u"Afficher les informations médicales"))
        self.check_messages = wx.CheckBox(
            self, -1, _(u"Afficher les messages individuels"))

        self.label_groupes = wx.StaticText(
            self, -1, _(u"Cochez les groupes concernés :"))
        self.radio_groupes_tous = wx.RadioButton(self,
                                                 -1,
                                                 _(u"Tous les groupes"),
                                                 style=wx.RB_GROUP)
        self.radio_groupes_choix = wx.RadioButton(
            self, -1, _(u"Uniquement les groupes suivants :"))
        self.ctrl_groupes = CTRL_Groupes(self)
        self.ctrl_groupes.SetMinSize((100, 50))

        self.check_infos_medicales.SetToolTip(
            wx.ToolTip(
                _(u"Affiche les informations médicales. Attention, la case 'Afficher sur la commande des repas' doit avoir été cochée dans la fenêtre de saisie de l'information médicale."
                  )))
        self.check_messages.SetToolTip(
            wx.ToolTip(
                _(u"Affiche les messages individuels. Attention, la case 'Afficher sur la commande des repas' doit avoir été cochée dans la fenêtre de saisie du message."
                  )))

        # Layout
        grid_sizer_base = wx.FlexGridSizer(rows=7, cols=1, vgap=5, hgap=5)
        grid_sizer_base.Add(self.label_intro, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
        grid_sizer_base.Add(self.check_infos_medicales, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 0)
        grid_sizer_base.Add(self.check_messages, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 0)

        grid_sizer_base.Add(self.label_groupes, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL, 0)
        grid_sizer_base.Add(self.radio_groupes_tous, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 0)
        grid_sizer_base.Add(self.radio_groupes_choix, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 0)
        grid_sizer_base.Add(self.ctrl_groupes, 0,
                            wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, 0)

        grid_sizer_base.AddGrowableCol(0)
        grid_sizer_base.AddGrowableRow(6)
        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        self.Layout()

        # Binds
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioGroupes,
                  self.radio_groupes_tous)
        self.Bind(wx.EVT_RADIOBUTTON, self.OnRadioGroupes,
                  self.radio_groupes_choix)

        # Init
        self.ctrl_groupes.MAJ()
        self.OnRadioGroupes()
Example #28
0
 def __set_properties(self):
     self.check.SetToolTip(
         wx.ToolTip(
             _(u"Cochez cette case si vous souhaitez appliquer un filtre de périodes"
               )))
 def __set_properties(self):
     self.ctrl_mdp.SetToolTip(wx.ToolTip(_(u"Saisissez un mot de passe")))
     self.ctrl_confirmation.SetToolTip(wx.ToolTip(_(u"Confirmez le mot de passe en le saisissant une nouvelle fois")))
     self.bouton_ok.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour valider")))
     self.bouton_annuler.SetToolTip(wx.ToolTip(_(u"Cliquez ici pour annuler")))
     self.ctrl_mdp.SetMinSize((300, -1))
Example #30
0
    def __init__(self, parent, IDfamille=None):
        wx.Panel.__init__(self,
                          parent,
                          id=-1,
                          name="panel_cotisations",
                          style=wx.TAB_TRAVERSAL)
        self.parent = parent
        self.IDfamille = IDfamille

        self.staticbox_cotisations = wx.StaticBox(
            self, -1, _(u"Cotisations familiales et individuelles"))

        # OL Cotisations
        codesColonnes = [
            "IDcotisation", "date_debut", "date_fin", "beneficiaires", "nom",
            "numero", "date_creation_carte", "depot_nom", "activites",
            "observations"
        ]
        checkColonne = True
        triColonne = "date_debut"
        self.listviewAvecFooter = OL_Liste_cotisations.ListviewAvecFooter(
            self,
            kwargs={
                "IDfamille": IDfamille,
                "mode": "famille",
                "codesColonnes": codesColonnes,
                "checkColonne": checkColonne,
                "triColonne": triColonne
            })
        self.ctrl_listview = self.listviewAvecFooter.GetListview()
        self.ctrl_recherche = OL_Liste_cotisations.CTRL_Outils(
            self, listview=self.ctrl_listview, afficherCocher=True)
        self.ctrl_recherche.SetBackgroundColour((255, 255, 255))

        # Commandes boutons
        self.bouton_ajouter = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Ajouter.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_modifier = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Modifier.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_supprimer = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Supprimer.png"),
                      wx.BITMAP_TYPE_ANY))
        self.bouton_imprimer = wx.BitmapButton(
            self, -1,
            wx.Bitmap(Chemins.GetStaticPath(u"Images/16x16/Imprimante.png"),
                      wx.BITMAP_TYPE_ANY))

        # Binds
        self.Bind(wx.EVT_BUTTON, self.OnBoutonAjouter, self.bouton_ajouter)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonModifier, self.bouton_modifier)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonSupprimer, self.bouton_supprimer)
        self.Bind(wx.EVT_BUTTON, self.OnBoutonImprimer, self.bouton_imprimer)

        # Propriétés
        self.bouton_ajouter.SetToolTip(
            wx.ToolTip(_(u"Cliquez ici pour saisir une cotisation")))
        self.bouton_modifier.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour modifier la cotisation sélectionnée")))
        self.bouton_supprimer.SetToolTip(
            wx.ToolTip(
                _(u"Cliquez ici pour supprimer la cotisation sélectionnée")))
        self.bouton_imprimer.SetToolTip(
            wx.ToolTip(_(u"Cliquez ici pour imprimer un document")))

        # Layout
        grid_sizer_base = wx.FlexGridSizer(rows=1, cols=2, vgap=5, hgap=5)
        staticbox_cotisations = wx.StaticBoxSizer(self.staticbox_cotisations,
                                                  wx.VERTICAL)
        grid_sizer_cotisations = wx.FlexGridSizer(rows=2,
                                                  cols=2,
                                                  vgap=5,
                                                  hgap=5)

        grid_sizer_cotisations.Add(self.listviewAvecFooter, 1, wx.EXPAND, 0)

        grid_sizer_boutons = wx.FlexGridSizer(rows=6, cols=1, vgap=5, hgap=5)
        grid_sizer_boutons.Add(self.bouton_ajouter, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_modifier, 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_supprimer, 0, wx.ALL, 0)
        grid_sizer_boutons.Add((5, 5), 0, wx.ALL, 0)
        grid_sizer_boutons.Add(self.bouton_imprimer, 0, wx.ALL, 0)
        grid_sizer_cotisations.Add(grid_sizer_boutons, 1, wx.ALL, 0)

        grid_sizer_cotisations.Add(self.ctrl_recherche, 1, wx.EXPAND, 0)

        grid_sizer_cotisations.AddGrowableCol(0)
        grid_sizer_cotisations.AddGrowableRow(0)
        staticbox_cotisations.Add(grid_sizer_cotisations, 1,
                                  wx.EXPAND | wx.ALL, 5)
        grid_sizer_base.Add(staticbox_cotisations, 1, wx.EXPAND | wx.ALL, 5)

        grid_sizer_base.AddGrowableCol(0)
        grid_sizer_base.AddGrowableRow(0)

        self.SetSizer(grid_sizer_base)
        grid_sizer_base.Fit(self)
        self.Layout()