Esempio n. 1
0
 def destroy(self):
     toasterbox = tb.ToasterBox(self._parent,
                                tbstyle=tb.TB_COMPLEX,
                                closingstyle=tb.TB_ONTIME | tb.TB_ONCLICK)
     toasterbox.CleanList()
     tb.winlist = []
     self._application.onPreferencesDialogClose -= self._onPreferencesDialogClose
Esempio n. 2
0
def ToasterUtilisateur(parent,
                       titre=u"",
                       prenom=_(u"Philippe"),
                       nomImage="Femme",
                       taille=(200, 100),
                       couleurFond="#000000"):
    """ Affiche une boîte de dialogue temporaire """
    largeur, hauteur = (400, 148)  #taille
    tb = Toaster.ToasterBox(parent, Toaster.TB_COMPLEX,
                            Toaster.TB_DEFAULT_STYLE,
                            Toaster.TB_ONTIME)  # TB_CAPTION
    tb.SetTitle(titre)
    tb.SetPopupSize((largeur, hauteur))
    if 'phoenix' in wx.PlatformInfo:
        largeurEcran, hauteurEcran = wx.ScreenDC().GetSize()
    else:
        largeurEcran, hauteurEcran = wx.ScreenDC().GetSizeTuple()
    tb.SetPopupPosition(
        (largeurEcran - largeur - 10, hauteurEcran - hauteur - 50))
    tb.SetPopupPauseTime(3000)
    tb.SetPopupScrollSpeed(4)
    tb.SetPopupBackgroundColour(couleurFond)
    tb.SetPopupTextColour("#000000")

    tbpanel = tb.GetToasterBoxWindow()
    panel = wx.Panel(tbpanel, -1)
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizerHoriz = wx.BoxSizer(wx.HORIZONTAL)
    sizerTexte = wx.BoxSizer(wx.VERTICAL)

    # Image
    bmp = wx.StaticBitmap(
        panel, -1,
        wx.Bitmap(
            Chemins.GetStaticPath("Images/Avatars/128x128/%s.png" % nomImage),
            wx.BITMAP_TYPE_PNG))
    sizerHoriz.Add(bmp, 0, wx.ALL, 10)

    # Texte1
    texte1 = _(u"Bonjour")
    label1 = wx.StaticText(panel, -1, texte1, style=wx.ALIGN_CENTER)
    label1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD))
    label1.SetForegroundColour('Grey')
    sizerTexte.Add(label1, 1, wx.TOP | wx.EXPAND, 40)

    # Texte 2
    texte2 = prenom
    label2 = wx.StaticText(panel, -1, texte2, style=wx.ALIGN_CENTER)
    label2.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
    label2.SetForegroundColour('White')
    sizerTexte.Add(label2, 1, wx.TOP | wx.EXPAND, 0)

    sizerHoriz.Add(sizerTexte, 1, wx.EXPAND, 0)
    sizer.Add(sizerHoriz, 0, wx.EXPAND)
    panel.SetSizer(sizer)
    panel.Layout()

    tb.AddPanel(panel)

    tb.Play()
Esempio n. 3
0
    def afficher(self, record):
        if self.parent.IsShown():
            texte = self.format(record)
            tb = toast.ToasterBox(self.parent, toast.TB_SIMPLE,
                                  toast.TB_DEFAULT_STYLE,
                                  toast.TB_ONTIME | toast.TB_ONCLICK)

            w = 200
            h = 125
            tb.SetPopupSize((w, h))

            rect = self.parent.GetRect()
            x = rect[0] + rect[2] - w
            y = rect[1] + rect[3] - h
            tb.SetPopupPosition((x, y))

            tb.SetPopupPauseTime(3000)
            tb.SetPopupScrollSpeed(1)

            tb.SetPopupBackgroundColour(images.couleur('selection'))
            tb.SetPopupTextColour(images.couleur('texte_bouton'))

            tb.SetPopupText(texte)
            tb.SetPopupTextFont(wx.Font(12, wx.SWISS, wx.ITALIC, wx.NORMAL))

            tb.Play()
Esempio n. 4
0
 def OnAlarm(self, event):
     notify = tb.ToasterBox(None, closingstyle=tb.TB_ONCLICK)
     notify.SetPopupPauseTime(self._duration * 1000)
     msg = "Its time! Its time!\nClick to dismiss!"
     notify.SetPopupText(msg)
     notify.SetPopupPositionByInt(3)  # bottom right
     notify.Play()
 def test_lib_agw_toasterboxCtor(self):
     windowstyle = TB.TB_CAPTION
     tbstyle = TB.TB_COMPLEX
     closingstyle = TB.TB_ONCLICK
     
     tb = TB.ToasterBox(self.frame, tbstyle, windowstyle, closingstyle,
                        scrollType=TB.TB_SCR_TYPE_FADE)
     tb.Play()
Esempio n. 6
0
 def ayuda_toasterbox(self, posicion_x, posicion_y, texto, titulo):
     '''Función de ayuda ToasterBox'''
     # En Linux el toasterbox no funciona muy bien...
     if os.name == 'posix': return #  scrollType = TB.TB_SCR_TYPE_DU
     if os.name == 'nt': scrollType = TB.TB_SCR_TYPE_FADE
     tb = TB.ToasterBox(self, TB.TB_SIMPLE, TB.TB_SIMPLE,
                        TB.TB_ONTIME, scrollType = scrollType)
     tb.SetTitle(titulo)
     tb.SetPopupSize((200, 150))
     tb.SetPopupPosition((posicion_x, posicion_y))
     tb.SetPopupPauseTime(5000)
     tb.SetPopupScrollSpeed(20)
     tb.SetPopupText(texto)
     tb.Play()
Esempio n. 7
0
 def AfficheToaster(self, titre=u"", texte=u"", taille=(200, 100), couleurFond="#F0FBED"):
     """ Affiche une boîte de dialogue temporaire """
     largeur, hauteur = taille
     tb = Toaster.ToasterBox(wx.GetApp().GetTopWindow(), Toaster.TB_SIMPLE, Toaster.TB_DEFAULT_STYLE, Toaster.TB_ONTIME)  # TB_CAPTION
     tb.SetTitle(titre)
     tb.SetPopupSize((largeur, hauteur))
     if 'phoenix' not in wx.PlatformInfo:
         largeurEcran, hauteurEcran = wx.ScreenDC().GetSizeTuple()
     else :
         largeurEcran, hauteurEcran = wx.ScreenDC().GetSize()
     tb.SetPopupPosition((largeurEcran - largeur - 10, hauteurEcran - hauteur - 50))
     tb.SetPopupPauseTime(3000)
     tb.SetPopupScrollSpeed(8)
     tb.SetPopupBackgroundColour(couleurFond)
     tb.SetPopupTextColour("#000000")
     tb.SetPopupText(texte)
     tb.Play()
 def OnKillFocus(self, Event):
     text_str = self.tc.GetValue()
     if (not self.test_str(text_str)):
         self.tc.SetValue(self.lastValue)
         self.tc.SetFocus()
         invalid_val_tb = TB.ToasterBox(self)
         invalid_val_tb.SetPopupText('Only {0} values are allowed!'\
                                     .format(self.value_type))
         invalid_val_tb.SetPopupPosition((self.tc.GetScreenPosition()[0] \
                                     + 70, self.tc.GetScreenPosition()[1]))
         invalid_val_tb.SetPopupSize((70, 100))
         invalid_val_tb.SetPopupPauseTime(2000)
         invalid_val_tb.Play()
     else:
         if(self.value_type == 'real' and \
                     re.search(integer_pattern, text_str)):
             self.tc.SetValue(text_str + '.0')
         Event.Skip()
Esempio n. 9
0
    def __init__(self, parent):

        wx.Frame.__init__(self, parent, -1, "ToasterBox Demo")

        toaster = TB.ToasterBox(self, tbstyle=TB.TB_COMPLEX)
        toaster.SetPopupPauseTime(3000)

        tbpanel = toaster.GetToasterBoxWindow()
        panel = wx.Panel(tbpanel, -1)
        sizer = wx.BoxSizer(wx.VERTICAL)

        button = wx.Button(panel, wx.ID_ANY, "Simple button")
        sizer.Add(button, 0, wx.EXPAND)

        panel.SetSizer(sizer)
        toaster.AddPanel(panel)

        wx.CallLater(1000, toaster.Play)
Esempio n. 10
0
    def showMessage(self, message, title, captionBackgroundColor,
                    captionForegroundColor):

        toasterbox = tb.ToasterBox(self._parent,
                                   tbstyle=tb.TB_COMPLEX,
                                   closingstyle=tb.TB_ONTIME | tb.TB_ONCLICK)

        parent = toasterbox.GetToasterBoxWindow()
        panel = InfoPanel(parent, message, title, captionBackgroundColor,
                          captionForegroundColor)
        parent.SetBackgroundColour(self._theme.colorToasterBackground)
        toasterbox.AddPanel(panel)
        toasterbox.SetPopupPauseTime(self.toaster_delay)

        width, height = panel.GetSize()
        toasterbox.SetPopupSize((width, height))
        x, y = self._calcPopupPos(width, height)
        toasterbox.SetPopupPosition((x, y))
        toasterbox.Play()
        self.counter.incShowCount()
Esempio n. 11
0
    def Notify(self):
        if hasattr(self, 'TotalMsgs') and self.TotalMsgs > 0:
            toaster = TB.ToasterBox(self, tbstyle=TB.TB_COMPLEX)
            toaster.SetPopupSize((200, 120))
            toaster.SetPopupPauseTime(4000)
            toaster.SetPopupPositionByInt(3)
            toaster.SetPopupBackgroundColour('#F2F5A9')

            tbpanel = toaster.GetToasterBoxWindow()
            panel = wx.Panel(tbpanel, -1)
            sizer = wx.BoxSizer(wx.VERTICAL)

            sizer.AddSpacer(10)
            st = wx.StaticText(panel, wx.ID_ANY, label=u'有新消息!')
            sizer.Add(st, 0, wx.ALIGN_CENTER | wx.ALL, 10)

            button = wx.Button(panel, wx.ID_ANY, u"点击查看")
            self.Bind(wx.EVT_BUTTON, self.OnMessages, button)
            sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 10)

            panel.SetSizer(sizer)
            toaster.AddPanel(panel)
            wx.CallLater(1000, toaster.Play)
Esempio n. 12
0
 def destroy(self):
     toasterbox = tb.ToasterBox(self._parent,
                                tbstyle=tb.TB_COMPLEX,
                                closingstyle=tb.TB_ONTIME | tb.TB_ONCLICK)
     toasterbox.CleanList()
     tb.winlist = []