def __init__( self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, name="footer", ): self.hauteur = 24 self.afficherColonneDroite = True self.listview = None self.dictColonnes = {} self.dictTotaux = {} self.listeImpression = [] Control.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.SetInitialSize(size) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase) self.Bind(wx.EVT_SIZE, self.MAJ_affichage)
def __init__( self, parent, id=-1, pages=[], # list of pages or a text fgcolor=wx.BLACK, # text/foreground color bgcolor=None, # background color start=True, # if True, the newsticker starts immediately ppf=2, # pixels per frame fps=20, # frames per second pauseTime=2000, # Pause time (in milliseconds) headingStyle=5, # Style of heading : 1, 2, 3, 4 ou 5 or None for no heading pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, name="Newsticker"): Control.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.timer = wx.Timer(self, -1) self.timerPause = wx.Timer(self, -1) self.textSize = (-1, -1) self.decalage = 0 self._fps = fps self._ppf = ppf self.pauseTime = pauseTime self.pause = False self.pauseTemp = False self.indexPage = 0 self.headingStyle = headingStyle self.headingHeight = 0 self.SetPages(pages) self.SetInitialSize(size) if fgcolor != None: self.SetForegroundColour(fgcolor) if bgcolor != None: self.SetBackgroundColour(bgcolor) self.Bind(wx.EVT_TIMER, self.OnTick, self.timer) self.Bind(wx.EVT_TIMER, self.OnPause, self.timerPause) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) if start: self.Start()
def _AppendControl(self, sizer: wx.Sizer, label_str: str, ctrl: wx.Control): """Append a control, its label, and its info badge to the last row of the sizer. Returns the automaticaly created label and info badge (wx.StaticText for now). """ label = wx.StaticText(self, label=label_str) label.SetFont(self._label_font) rows = sizer.GetRows() sizer.Add(label, wx.GBPosition(rows, 1), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT) sizer.Add(ctrl, wx.GBPosition(rows, 2), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) sizer.Add(0, self._info_length, wx.GBPosition(rows, 4), wx.GBSpan(1, 1)) info_badge = wx.StaticBitmap(self, bitmap=self._info_bitmap) info_badge.Show(False) sizer.Add(info_badge, wx.GBPosition(rows, 3), wx.GBSpan(1, 1), flag=wx.ALIGN_CENTER) self.labels[ctrl.GetId()] = label self.badges[ctrl.GetId()] = info_badge
def __init__(self, parent, id=-1, pages=[], # list of pages or a text fgcolor = wx.BLACK, # text/foreground color bgcolor = None, # background color start=True, # if True, the newsticker starts immediately ppf=2, # pixels per frame fps=20, # frames per second pauseTime = 2000, # Pause time (in milliseconds) headingStyle = 5, # Style of heading : 1, 2, 3, 4 ou 5 or None for no heading pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, name="Newsticker" ): Control.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.timer = wx.Timer(self, -1) self.timerPause = wx.Timer(self, -1) self.textSize = (-1, -1) self.decalage = 0 self._fps = fps self._ppf = ppf self.pauseTime = pauseTime self.pause = False self.pauseTemp = False self.indexPage = 0 self.headingStyle = headingStyle self.headingHeight = 0 self.SetPages(pages) self.SetInitialSize(size) if fgcolor != None : self.SetForegroundColour(fgcolor) if bgcolor != None : self.SetBackgroundColour(bgcolor) self.Bind(wx.EVT_TIMER, self.OnTick, self.timer) self.Bind(wx.EVT_TIMER, self.OnPause, self.timerPause) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) if start: self.Start()
def __init__(self, parent, images, names=None): # call parent __init__() wxControl.__init__(self, parent=parent, id=wxID_ANY, pos=wxDefaultPosition, size=wxDefaultSize, style=wxNO_BORDER, validator=wxDefaultValidator, name="") # PARAMETERS self.parent = parent # single image: if isinstance(images, wxBitmap): self.images = [images] if isinstance(names, str): self.names = [names] # list of images elif isinstance(images, list): self.images = images self.names = names # dictionary images else: self.images = images.Values() self.names = images.Keys() # status is an index or a name self.status = 0 # get png size from first image w, h = self.images[self.status].GetSize() self.SetSize((w, h)) # BINDINGS self.Bind(wxEVT_ERASE_BACKGROUND, self._onEraseBackground) self.Bind(wxEVT_PAINT, self._onPaint) # done return
def _setBrailleFont(fontName: str, textCtrl: wx.Control) -> wx.Font: fonts.importFonts() # Ideally the raw characters should align with the braille dots. # # On most systems, it seems that Windows will fall back to using "Segoe UI Symbol" font. # The width of BRAILLE_SPACE_CHARACTER ('no pins up') does not match the other braille characters. # This causes variations in the length of the braille text, particularly when the cursor is flashing. # The other disadvantage of using this font is that it is difficult to get its width to match the width # of the raw text characters. # These issues are solved by using a custom font (FreeMono-FixedBraille), which due to its free (GPL 3) # status, allowed us to modify it, and fix the visual issues that it also had. # # Remaining visual issues: # Some words when translated to braille have more characters than the raw text. # This may be because there is a leading "number" or "capital letter" cell. # Currently we do not handle this. font: wx.Font = textCtrl.GetFont() font.SetPointSize(20) font.SetFaceName(fontName) textCtrl.SetFont(font) return font
def __init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER, name="footer", ): self.hauteur = 24 self.afficherColonneDroite = True self.listview = None self.dictColonnes = {} self.dictTotaux = {} self.listeImpression = [] Control.__init__(self, parent, id=id, pos=pos, size=size, style=style, name=name) self.SetInitialSize(size) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase) self.Bind(wx.EVT_SIZE, self.MAJ_affichage)
def __init__(self, parent, id=-1, texte=u"", couleurClaire=(255, 255, 255), couleurFoncee=(255, 0, 0), selection=False, taille=wx.DefaultSize): Control.__init__(self, parent, id=id, pos=wx.DefaultPosition, size=taille, style=wx.NO_BORDER, name="boutonToggle") self.parent = parent self.texte = texte self.couleurClaire = couleurClaire self.couleurFoncee = couleurFoncee self.couleurSelection = (0, 255, 0) self.selection = selection self.survol = False self.marge = 10 self.bestSize = (-1, -1) # Ajustement de la hauteur du contrôle dc = wx.ClientDC(self) dc.SetFont( wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "MS Shell Dlg 2")) largeur, hauteur = self.DrawTexte(dc) self.SetClientSize((largeur, hauteur)) self.SetSize(self.GetClientSize()) self.SetInitialSize(self.GetClientSize()) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None) self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)
def __init__(self, parent, id=-1, texte=u"", couleurClaire=(255, 255, 255), couleurFoncee=(255, 0, 0), selection=False, taille=wx.DefaultSize): Control.__init__(self, parent, id=id, pos=wx.DefaultPosition, size=taille, style=wx.NO_BORDER, name="boutonToggle") self.parent = parent self.texte = texte self.couleurClaire = couleurClaire self.couleurFoncee = couleurFoncee self.couleurSelection = (0, 255, 0) self.selection = selection self.survol = False self.marge = 10 self.bestSize = (-1, -1) # Ajustement de la hauteur du contrôle dc = wx.ClientDC(self) dc.SetFont(wx.Font(24, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "MS Shell Dlg 2")) largeur, hauteur = self.DrawTexte(dc) self.SetClientSize((largeur, hauteur)) self.SetSize(self.GetClientSize()) self.SetInitialSize(self.GetClientSize()) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x:None) self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)