Beispiel #1
0
    def __init__(self, parent):
        
        wx.Panel.__init__(self, parent)

        

        self.parent = parent

        bSizer1 = wx.BoxSizer( wx.HORIZONTAL )

                
        c6 = ac.AnalogClock(self, size=(200,200),style = wx.RAISED_BORDER)

        colour = wx.Colour(255, 255, 40)
        c6.SetFaceFillColour(colour)
        colour = wx.Colour(220, 176, 3)
        c6.SetBackgroundColour(colour)

        bSizer1.Add(c6,0,wx.EXPAND|wx.ALL,5)

        #self.mbtn3 = wx.Button( self, wx.ID_ANY, u">", wx.DefaultPosition, wx.Size( 20,200 ), wx.BU_EXACTFIT )
        #bSizer1.Add( self.mbtn3, 1, wx.ALL|wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL, 5 )

        #cal1 = MyPanel2(self,-1,-1)
        #bSizer1.Add(cal1,0,wx.EXPAND|wx.ALL,5)
        
        

        self.SetSizer(bSizer1)
        self.Layout()
Beispiel #2
0
def makeClock(parent, sizer):
	clock = ac.AnalogClock(parent, size=(80,80), style=wx.RAISED_BORDER,
                                hoursStyle=ac.TICKS_DECIMAL,
                                minutesStyle=ac.TICKS_NONE,
                                clockStyle=ac.SHOW_HOURS_TICKS| \
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND)
	sizer.Add(clock, 0, wx.ALIGN_BOTTOM | wx.ALL, 5)
	return clock
Beispiel #3
0
 def makeClock(parent, has_hand=True):
     style = ac.SHOW_HOURS_TICKS
     if has_hand:
         style |= ac.SHOW_HOURS_HAND | ac.SHOW_MINUTES_HAND
     ctrl = ac.AnalogClock(parent,
                           size=(300, 300),
                           hoursStyle=ac.TICKS_DECIMAL,
                           clockStyle=style)
     ctrl.SetBackgroundColour(wx.Colour(255, 255, 255))
     ctrl.SetFaceFillColour(wx.Colour(255, 255, 255))
     return ctrl
Beispiel #4
0
def wxClock(parent):
    import wx.lib.analogclock as ac

    cl = ac.AnalogClock( parent,
                         style        = wx.STATIC_BORDER,
                         hoursStyle   = ac.TICKS_SQUARE,
                         minutesStyle = ac.TICKS_CIRCLE,
                         clockStyle   = ac.SHOW_HOURS_TICKS \
                             | ac.SHOW_MINUTES_TICKS        \
                             | ac.SHOW_HOURS_HAND           \
                             | ac.SHOW_MINUTES_HAND         \
                             | ac.SHOW_SECONDS_HAND )

    cl.SetTickSize(12, target=ac.HOUR)

    return cl
Beispiel #5
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, id=-1, style=wx.TAB_TRAVERSAL)
        self.dateJour = datetime.date.today()
        self.dictOrganisateur = None

        # Horloge
        self.ctrl_horloge = clock.AnalogClock(self, size=(80, 80),
                            hoursStyle=clock.TICKS_CIRCLE,
                            minutesStyle=clock.TICKS_CIRCLE,
                            clockStyle=clock.SHOW_HOURS_TICKS| \
                                       clock.SHOW_MINUTES_TICKS|
                                       clock.SHOW_HOURS_HAND| \
                                       clock.SHOW_MINUTES_HAND| \
                                       clock.SHOW_SECONDS_HAND)
        self.ctrl_horloge.SetTickSize(12, target=clock.HOUR)

        # Date du jour
        self.ctrl_date = wx.StaticText(self, -1, DateDDEnDateFR(self.dateJour))

        # Newsticker
        self.ctrl_ticker = CTRL_Newsticker.Newsticker(self,
                                                      pauseTime=10000,
                                                      start=False,
                                                      size=(-1, 100))
        self.ctrl_ticker.SetFont(
            wx.Font(7, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))

        # Adaptation pour Linux : Couleur de l'horloge
        if "linux" in sys.platform:
            couleur = self.ctrl_date.GetBackgroundColour()
            self.ctrl_horloge.SetBackgroundColour(couleur)
            self.ctrl_horloge.SetFaceFillColour(couleur)
            self.ctrl_horloge.SetFaceBorderColour(couleur)

        self.__set_properties()
        self.__do_layout()

        self.ctrl_ticker.Start()
Beispiel #6
0
    def __init__(self, parent):

        wx.Panel.__init__(self, parent)

        self.parent = parent

        bSizer1 = wx.BoxSizer(wx.HORIZONTAL)

        c6 = ac.AnalogClock(self, size=(200, 200), style=wx.RAISED_BORDER)

        colour = wx.Colour(255, 255, 40)
        c6.SetFaceFillColour(colour)
        colour = wx.Colour(220, 176, 3)
        c6.SetBackgroundColour(colour)

        bSizer1.Add(c6, 0, wx.EXPAND | wx.ALL, 5)

        cal1 = MyPanel2(self, -1, -1)

        bSizer1.Add(cal1, 0, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(bSizer1)
        self.Layout()
Beispiel #7
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1, name="panel_gadget_horloge")
        self.parent = parent
        dictParam = self.parent.paramGadget

        # Import
        import wx.lib.analogclock as clock

        # Données
        couleurFace = dictParam["couleur_face"]
        couleurFond = dictParam["couleur_fond"]

        # Widgets
        self.horloge = clock.AnalogClock(self, size=(160, 160))
        self.horloge.SetBackgroundColour(couleurFond)
        self.parent.couleurFondCadre = couleurFond
        self.horloge.SetFaceFillColour(couleurFace)

        # Layout
        self.sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer.Add(self.horloge, 1, wx.EXPAND)
        self.SetSizer(self.sizer)
        self.SetAutoLayout(True)
Beispiel #8
0
    def __init__(self, parent, log):
        self.log = log
        wx.Panel.__init__(self, parent)

        # A mostly default clock
        c1 = ac.AnalogClock(self, size=(200, 200))

        if True:  # for a simpler test case just set this to False and
            # only the one clock will be created

            # A plain clock, with square hour and round minute marks, no
            # shadow, static border
            c2 = ac.AnalogClock(self, style=wx.STATIC_BORDER,
                                hoursStyle=ac.TICKS_SQUARE,
                                minutesStyle=ac.TICKS_CIRCLE,
                                clockStyle=ac.SHOW_HOURS_TICKS| \
                                           ac.SHOW_MINUTES_TICKS|
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND| \
                                           ac.SHOW_SECONDS_HAND)
            c2.SetTickSize(12, target=ac.HOUR)

            # No minute tick marks
            c3 = ac.AnalogClock(self, hoursStyle=ac.TICKS_CIRCLE,
                                clockStyle=ac.SHOW_HOURS_TICKS| \
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND| \
                                           ac.SHOW_SECONDS_HAND| \
                                           ac.SHOW_SHADOWS)
            c3.SetTickSize(12)

            # A clock with hex numbers no seconds hand and different colours.
            c4 = ac.AnalogClock(self, hoursStyle=ac.TICKS_HEX,
                                clockStyle=ac.SHOW_HOURS_TICKS| \
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND| \
                                           ac.SHOW_SHADOWS)
            colour = wx.CYAN
            c4.SetForegroundColour(colour)
            colour = wx.Colour(0, 132, 132)
            c4.SetShadowColour(colour)
            c4.SetTickFont(
                wx.Font(10, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL,
                        wx.FONTWEIGHT_BOLD))
            c4.SetBackgroundColour(wx.BLACK)
            c4.SetFaceBorderColour(wx.BLACK)
            c4.SetFaceFillColour(wx.BLACK)

            # A clock with binary numbers shown only at the quarter tick marks,
            # no minutes ticks and different colours.
            c5 = ac.AnalogClock(self, style = wx.RAISED_BORDER,
                                hoursStyle=ac.TICKS_BINARY,
                                clockStyle=ac.SHOW_QUARTERS_TICKS| \
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND| \
                                           ac.SHOW_SECONDS_HAND| \
                                           ac.SHOW_SHADOWS)
            colour = wx.Colour(0, 128, 0)
            c5.SetHandFillColour(colour, target=ac.SECOND)
            c5.SetHandBorderColour(colour, target=ac.SECOND)
            c5.SetBackgroundColour(colour)
            colour = wx.Colour(128, 0, 64)
            c5.SetTickFillColour(colour)
            c5.SetFaceBorderColour(colour)
            c5.SetFaceBorderWidth(1)
            colour = wx.Colour(0, 198, 0)
            c5.SetFaceFillColour(colour)
            c5.SetShadowColour(wx.WHITE)

            # A clock with a sunken border, roman numerals shown only at the
            # quarter tick marks with a roman font, circular minutes ticks,
            # no seconds hand, no shadows, tick overlapping and different colours.
            c6 = ac.AnalogClock(self, style = wx.SUNKEN_BORDER,
                                hoursStyle=ac.TICKS_ROMAN,
                                minutesStyle=ac.TICKS_CIRCLE,
                                clockStyle=ac.SHOW_QUARTERS_TICKS| \
                                           ac.SHOW_MINUTES_TICKS| \
                                           ac.SHOW_HOURS_HAND| \
                                           ac.SHOW_MINUTES_HAND| \
                                           ac.OVERLAP_TICKS)
            colour = wx.Colour(128, 0, 0)
            c6.SetHandFillColour(colour)
            colour = wx.Colour(179, 0, 89)
            c6.SetHandBorderColour(colour)
            c6.SetTickFillColour(colour)
            c6.SetTickBorderColour(colour)
            colour = wx.Colour(225, 255, 255)
            c6.SetFaceBorderColour(colour)
            c6.SetBackgroundColour(colour)
            colour = wx.Colour(249, 255, 255)
            c6.SetFaceFillColour(colour)
            colour = wx.Colour(255, 213, 213)
            c6.SetShadowColour(colour)
            c6.SetTickFont(
                wx.Font(10, wx.FONTFAMILY_ROMAN, wx.FONTSTYLE_NORMAL,
                        wx.FONTWEIGHT_BOLD))

            # layout the clocks in a grid
            gs = wx.GridSizer(2, 3, 4, 4)
            gs.Add(c1, 0, wx.EXPAND)
            gs.Add(c2, 0, wx.EXPAND)
            gs.Add(c3, 0, wx.EXPAND)
            gs.Add(c4, 0, wx.EXPAND)
            gs.Add(c5, 0, wx.EXPAND)
            gs.Add(c6, 0, wx.EXPAND)

            # put it in another sizer for a border
            sizer = wx.BoxSizer(wx.VERTICAL)
            sizer.Add(gs, 1, wx.EXPAND | wx.ALL, 10)

            self.SetSizerAndFit(sizer)
#!/usr/bin/env python

#-Imports---------------------------------------------------------------------

#--wxPython Imports.
import wx
import wx.lib.analogclock as ac

if __name__ == '__main__':
    app = wx.App()
    frame = wx.Frame(None, -1, 'Minimal AnalogClock Demo')
    clock = ac.AnalogClock(frame, size=(200, 200))
    frame.CreateStatusBar().SetStatusText('wxPython %s' % wx.version())
    frame.Show()
    app.MainLoop()
Beispiel #10
0
    def __init__(self,
                 parent,
                 id=-1,
                 title="EasyAlarmer",
                 pos=wx.DefaultPosition,
                 size=(300, 400),
                 style=wx.CAPTION | wx.MINIMIZE_BOX | wx.CLOSE_BOX
                 | wx.SYSTEM_MENU | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP):
        #style =wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR | wx.STAY_ON_TOP ) :

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

        #self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.Bind(wx.EVT_ICONIZE, self.OnIconfiy)

        #SysTray Icon Setup
        if hasattr(sys, "frozen") and getattr(sys, "frozen") == "windows_exe":
            exeName = win32api.GetModuleFileName(
                win32api.GetModuleHandle(None))
            self.tbIcon = wx.Icon(exeName, wx.BITMAP_TYPE_ICO)
        else:
            self.tbIcon = wx.Icon("EasyAlarmer.ico", wx.BITMAP_TYPE_ICO)

        self.tb = wx.TaskBarIcon()
        self.tb.Bind(wx.EVT_TASKBAR_RIGHT_UP, self.OnTaskBarRightClick)

        self.SetIcon(self.tbIcon)

        self.tb.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.OnShow)

        wx.EVT_MENU(self.tb, TB_SHOW, self.OnShow)
        wx.EVT_MENU(self.tb, TB_CLOSE, self.OnExit)

        #Setup Timer and TimerList
        self.LastClockTime = wx.DateTime_Now()
        self.ClockInterval = 1
        self.AlamerList = list()

        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.Timer = wx.Timer(self, -1)
        self.Timer.Start(self.ClockInterval * 1000)

        # Create Panel and Buttons
        panel = wx.Panel(self, size=(300, 30))
        panel_sizer = wx.BoxSizer(wx.HORIZONTAL)
        panel_sizer.SetMinSize((300, 40))

        self.AddBtn = wx.Button(panel, -1, u"添加")
        self.EditBtn = wx.Button(panel, -1, u"修改")
        self.DelBtn = wx.Button(panel, -1, u"删除")

        self.Bind(wx.EVT_BUTTON, self.OnAddAlarmItem, self.AddBtn)
        self.Bind(wx.EVT_BUTTON, self.OnEditAlarmItem, self.EditBtn)
        self.Bind(wx.EVT_BUTTON, self.OnDelAlarmItem, self.DelBtn)

        #panel_sizer.AddSpacer(80,10)
        panel_sizer.Add(self.AddBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel_sizer.Add(self.EditBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel_sizer.Add(self.DelBtn, 1, wx.ALL | wx.EXPAND, 5)
        panel.SetSizer(panel_sizer)
        panel.Layout()

        #Create Panel and  Analog Clock
        clockPanel = wx.Panel(self, size=(300, 300))
        clockPanelSizer = wx.BoxSizer(wx.HORIZONTAL)
        clockPanelSizer.SetMinSize((300, 300))
        self.clock = ac.AnalogClock(clockPanel, size=(250,250), hoursStyle = ac.TICKS_DECIMAL,clockStyle=ac.SHOW_HOURS_TICKS| \
                                                 ac.SHOW_HOURS_HAND| \
                                                 ac.SHOW_MINUTES_HAND| \
                   ac.SHOW_SECONDS_HAND| \
                                                 ac.SHOW_SHADOWS)
        colour = wx.Colour(128, 0, 0)
        self.clock.SetHandFillColour(colour)
        colour = wx.Colour(179, 0, 89)
        self.clock.SetHandBorderColour(colour)
        self.clock.SetTickFillColour(colour)
        self.clock.SetTickBorderColour(colour)
        #colour = wx.Colour(225, 255, 255)
        #self.clock.SetFaceBorderColour(colour)
        #self.clock.SetBackgroundColour(colour)
        colour = wx.Colour(249, 255, 255)
        self.clock.SetFaceFillColour(colour)
        colour = wx.Colour(255, 213, 213)
        self.clock.SetShadowColour(colour)
        self.clock.SetTickFont(
            wx.Font(10, wx.FONTFAMILY_ROMAN, wx.NORMAL, wx.BOLD))

        clockPanelSizer.Add(self.clock, 0, wx.ALL, 25)

        #Create AlarmListCtrl
        self.list = AlarmerListCtrl(self,
                                    -1,
                                    size=(300, 150),
                                    style=wx.LC_REPORT)
        self.list.Bind(wx.EVT_LEFT_DCLICK, self.OnEditAlarmItem, self.list)
        self.list.PopulateList()

        # Use a sizer to layout the controls, stacked vertically and with
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(clockPanelSizer, 0, wx.ALL, 0)
        sizer.Add(self.list, 0, wx.ALL, 0)
        sizer.Add(panel, 0, wx.ALL, 0)
        self.SetSizerAndFit(sizer)

        width, height = self.GetSizeTuple()
        dispSize = wx.GetClientDisplayRect()
        newPos = wx.Point()
        newPos.x = dispSize.width - width - 1
        newPos.y = (dispSize.height - height) / 2
        self.SetPosition(newPos)