Пример #1
0
    def __init__(self):
    
        self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        
        window.set_title("PyAla")
        window.set_position(gtk.WIN_POS_CENTER)
        
        #ic = gtk.Image(); ic.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)
        #window.set_icon(ic.get_pixbuf())
        
        www = gtk.gdk.screen_width(); hhh = gtk.gdk.screen_height();
        window.set_default_size(www/2, hhh/2)
        
        window.set_flags(gtk.CAN_FOCUS | gtk.SENSITIVE)
         
        window.set_events(  gtk.gdk.POINTER_MOTION_MASK |
                            gtk.gdk.POINTER_MOTION_HINT_MASK |
                            gtk.gdk.BUTTON_PRESS_MASK |
                            gtk.gdk.BUTTON_RELEASE_MASK |
                            gtk.gdk.KEY_PRESS_MASK |
                            gtk.gdk.KEY_RELEASE_MASK |
                            gtk.gdk.FOCUS_CHANGE_MASK )
         
        window.connect("destroy", self.OnExit)
        window.connect("key-press-event", self.key_press_event)        
        window.connect("button-press-event", self.button_press_event)        
        
        try:
            window.set_icon_from_file("ala.png")
        except:
            pass
                    
        vbox = gtk.VBox(); hbox = gtk.HBox()
        lab1 = gtk.Label("");  hbox.pack_start(lab1)
        
        butt1 = gtk.Button(" _New Alarm")
        butt1.connect("clicked", self.show_new, window)
        hbox.pack_start(butt1, False)
        
        butt2 = gtk.Button(" E_xit ")
        butt2.connect("clicked", self.OnExit, window)
        hbox.pack_start(butt2, False)
        
        lab2 = gtk.Label("");  hbox.pack_start(lab2)
        vbox.pack_end(hbox, False)
        
        hbox2 = gtk.HBox()
        lab3  = gtk.Label("");  hbox2.pack_start(lab3, False)
        self.listx = pyalalist.PySAlaList(); hbox2.pack_start(self.listx)
        lab4  = gtk.Label("");  hbox2.pack_start(lab4, False)
        vbox.pack_start(hbox2)

        
        window.add(vbox)
        window.show_all()
Пример #2
0
    def __init__(self, rtcflag, conf):
    
        self.rtcflag = rtcflag
        self.conf = conf
        self.titles = "Showing Events", "Current Spooler Content", \
                            "Alarm History", "Missed Alarms", "Clock"
                
        gtk.Window.__init__(self)
      
        self.set_title("PyAla")
        self.set_position(gtk.WIN_POS_CENTER)
        
        www = gtk.gdk.screen_width(); hhh = gtk.gdk.screen_height();
        self.set_default_size(www/2, hhh/2)
        self.set_geometry_hints(min_width=450, min_height=100)
        self.set_flags(gtk.CAN_FOCUS | gtk.SENSITIVE)
         
        self.set_events(  gtk.gdk.POINTER_MOTION_MASK |
                            gtk.gdk.POINTER_MOTION_HINT_MASK |
                            gtk.gdk.BUTTON_PRESS_MASK |
                            gtk.gdk.BUTTON_RELEASE_MASK |
                            gtk.gdk.KEY_PRESS_MASK |
                            gtk.gdk.KEY_RELEASE_MASK |
                            gtk.gdk.FOCUS_CHANGE_MASK )
         
        self.connect("destroy", self.OnExit)
        self.connect("key-press-event", self.key_press_event)        
        self.connect("button-press-event", self.button_press_event)        
        
        self.focus = False
        try:
            self.set_icon_from_file("ala.png")
        except:
            try:
                self.set_icon_from_file("/usr/share/pyala/ala.png")
            except:
                print "Cannot load icon file.", sys.exc_info()

        vbox = gtk.VBox(); hbox = gtk.HBox()
        lab1 = gtk.Label("");  hbox.pack_start(lab1)
        
        butt1 = gtk.Button(" _New Alarm")
        butt1.connect("clicked", self.show_new, self)
        hbox.pack_start(butt1, False)
        
        self.connect('show', self.showme)

        if self.conf.hide:
            self.set_decorated(False)
            self.connect('destroy', self.hideme)
        else: 
            self.connect('destroy', self.destroyme)
        
        if not self.conf.hide:
            butt2 = gtk.Button(" E_xit ")
            butt2.connect("clicked", self.OnExit, self)
            hbox.pack_start(butt2, False)
            
        butt3 = gtk.Button(" Hi_de ")
        butt3.connect("clicked", self.hideme)
        hbox.pack_start(butt3, False)
        
        lab2 = gtk.Label("");  hbox.pack_start(lab2)
        vbox.pack_end(hbox, False)
        
        # Create note for the main window, give access to it for all
        self.notebook = gtk.Notebook(); 
        #self.notebook.popup_enable()
        self.notebook.set_scrollable(True)

        #notebook.add_events(gtk.gdk.FOCUS_CHANGE_MASK)
        self.notebook.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.notebook.connect("switch-page", self.note_swpage_cb)
        self.notebook.connect("focus-in-event", self.note_focus_in)
        
        hbox2 = gtk.HBox()
        lab3  = gtk.Label("");  hbox2.pack_start(lab3, False)
        hbox2.pack_start(self.notebook)
        
        self.listx = pyalalist.PySAlaList(); 
        self.notebook.append_page(self.listx)
        tablab = gtk.Label(" Events ")
        ppp = self.notebook.get_nth_page(0)
        self.notebook.set_tab_label(ppp, tablab)
        
        self.lists = pyalalist.PySAlaList(); 
        self.notebook.append_page(self.lists)
        tablab2 = gtk.Label(" Spooler ")
        ppp = self.notebook.get_nth_page(1)
        self.notebook.set_tab_label(ppp, tablab2)
        
        self.listd = pyalalist.PySAlaList(); 
        self.notebook.append_page(self.listd)
        tablab3 = gtk.Label(" History ")
        ppp = self.notebook.get_nth_page(2)
        self.notebook.set_tab_label(ppp, tablab3)
        
        self.listm = pyalalist.PySAlaList(); 
        self.notebook.append_page(self.listm)
        tablab4 = gtk.Label(" Missed ")
        ppp = self.notebook.get_nth_page(3)
        self.notebook.set_tab_label(ppp, tablab4)
        
        self.listc = pyalaclock.PySAlaClock(); 
        self.notebook.append_page(self.listc)
        tablab5 = gtk.Label(" Clock ")
        ppp = self.notebook.get_nth_page(4)
        self.notebook.set_tab_label(ppp, tablab5)
        
        vbox.pack_start(hbox2)
        
        self.add(vbox)
        self.show_all()
        if self.conf.hide:
            self.window.hide()
        
        # Iterate thru tabs, show them, set landing page
        for aa in range(self.notebook.get_n_pages()):
            self.notebook.set_current_page(aa)
        self.notebook.set_current_page(0)
Пример #3
0
    def __init__(self):

        self.window = window = gtk.Window(gtk.WINDOW_TOPLEVEL)

        window.set_title("PyAla")
        window.set_position(gtk.WIN_POS_CENTER)

        #ic = gtk.Image(); ic.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_BUTTON)
        #window.set_icon(ic.get_pixbuf())

        www = gtk.gdk.screen_width()
        hhh = gtk.gdk.screen_height()
        window.set_default_size(www / 2, hhh / 2)

        window.set_flags(gtk.CAN_FOCUS | gtk.SENSITIVE)

        window.set_events(gtk.gdk.POINTER_MOTION_MASK
                          | gtk.gdk.POINTER_MOTION_HINT_MASK
                          | gtk.gdk.BUTTON_PRESS_MASK
                          | gtk.gdk.BUTTON_RELEASE_MASK
                          | gtk.gdk.KEY_PRESS_MASK | gtk.gdk.KEY_RELEASE_MASK
                          | gtk.gdk.FOCUS_CHANGE_MASK)

        window.connect("destroy", self.OnExit)
        window.connect("key-press-event", self.key_press_event)
        window.connect("button-press-event", self.button_press_event)

        self.focus = False
        try:
            window.set_icon_from_file("ala.png")
        except:
            pass

        vbox = gtk.VBox()
        hbox = gtk.HBox()
        lab1 = gtk.Label("")
        hbox.pack_start(lab1)

        butt1 = gtk.Button(" _New Alarm")
        butt1.connect("clicked", self.show_new, window)
        hbox.pack_start(butt1, False)

        butt2 = gtk.Button(" E_xit ")
        butt2.connect("clicked", self.OnExit, window)
        hbox.pack_start(butt2, False)

        lab2 = gtk.Label("")
        hbox.pack_start(lab2)
        vbox.pack_end(hbox, False)

        # Create note for the main window, give access to it for all
        self.notebook = gtk.Notebook()
        self.notebook.popup_enable()
        self.notebook.set_scrollable(True)

        #notebook.add_events(gtk.gdk.FOCUS_CHANGE_MASK)
        self.notebook.add_events(gtk.gdk.ALL_EVENTS_MASK)
        self.notebook.connect("switch-page", self.note_swpage_cb)
        self.notebook.connect("focus-in-event", self.note_focus_in)

        hbox2 = gtk.HBox()
        lab3 = gtk.Label("")
        hbox2.pack_start(lab3, False)
        hbox2.pack_start(self.notebook)

        self.listx = pyalalist.PySAlaList()
        self.notebook.append_page(self.listx)
        tablab = gtk.Label(" Alarm Events ")
        ppp = self.notebook.get_nth_page(0)
        self.notebook.set_tab_label(ppp, tablab)

        self.lists = pyalalist.PySAlaList()
        self.notebook.append_page(self.lists)
        tablab2 = gtk.Label(" Spooler ")
        ppp = self.notebook.get_nth_page(1)
        self.notebook.set_tab_label(ppp, tablab2)

        self.listd = pyalalist.PySAlaList()
        self.notebook.append_page(self.listd)
        tablab3 = gtk.Label(" History ")
        ppp = self.notebook.get_nth_page(2)
        self.notebook.set_tab_label(ppp, tablab3)
        lab4 = gtk.Label("")
        hbox2.pack_start(lab4, False)

        vbox.pack_start(hbox2)

        window.add(vbox)
        window.show_all()

        # Iterate thru tabs, show them, set landing page
        for aa in range(3):
            self.notebook.set_current_page(aa)
        self.notebook.set_current_page(0)