def main():
    from loader import load_tips
    tips = load_tips()
    
    import random
    index = random.randint(0, len(tips)-1)
    tip = tips[index]
    
    notify( _('Tip of the day'), tip )
Esempio n. 2
0
def main():
    from loader import load_tips
    tips = load_tips()

    import random
    index = random.randint(0, len(tips) - 1)
    tip = tips[index]

    notify(_('Tip of the day'), tip)
def main():
    import common as COMMON
    
    DESKTOP = None
    
    if Config.is_Mint() or Config.is_Ubuntu():
        import ubuntu as DISTRIBUTION
    elif Config.is_Fedora():
        import fedora as DISTRIBUTION
    else:
        DISTRIBUTION = None
    
    from loader import load_tips
    tips = load_tips(COMMON, DESKTOP, DISTRIBUTION)
    
    import random
    index = random.randint(0, len(tips)-1)
    tip = tips[index]
    
    notify( _('Tip of the day'), tip )
Esempio n. 4
0
    def __init__(self):
        import gtk
        from support.releasenotesviewer import ReleaseNotesViewer

        gtk.Window.__init__(self)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_title(_("Tip of the Day"))
        self.set_border_width(10)

        title = gtk.Label()
        title.set_markup(_('<span size="x-large"><b>Did you know ?</b></span>'))
        title.set_alignment(0.5, 0.5)
        titlebox = gtk.HBox(False, 10)
        titlebox.pack_start(gtk.image_new_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_DIALOG), False, False, 0)
        titlebox.pack_start(title)

        content = ReleaseNotesViewer()
        gray_bg(content)
        content.set_cursor_visible(False)
        content.set_wrap_mode(gtk.WRAP_WORD)

        scroll_content = gtk.ScrolledWindow()
        scroll_content.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll_content.add(content)
        scroll_content.set_size_request(-1, 200)

        close_button = stock_image_only_button(gtk.STOCK_CLOSE)

        def close_me(w):
            self.destroy()

        close_button.connect("clicked", close_me)

        next_tip = stock_image_only_button(gtk.STOCK_GO_FORWARD)
        next_tip.connect("clicked", self.__next_tip, content)
        next_tip.grab_focus()

        previous_tip = stock_image_only_button(gtk.STOCK_GO_BACK)
        previous_tip.connect("clicked", self.__previous_tip, content)

        submit_skills = image_stock_button(gtk.STOCK_GO_UP, _("Submit Linux Skills"))
        submit_skills.connect("clicked", report_bug)

        show_all_tips = image_stock_button(gtk.STOCK_INDEX, _("Show all tips"))
        show_all_tips.connect("clicked", self.__show_all_tips)

        hbox = gtk.HBox(False, 10)
        hbox.pack_end(close_button, False, False)
        hbox.pack_end(next_tip, False, False)
        hbox.pack_end(previous_tip, False, False)
        hbox.pack_end(submit_skills, False, False)
        hbox.pack_end(show_all_tips, False, False)

        box = gtk.VBox(False, 0)
        box.pack_start(titlebox, False)
        box.pack_start(scroll_content, False)
        box.pack_start(hbox, False)
        box.show_all()

        self.add(box)
        global tips
        if tips == None:
            import loader

            tips = loader.load_tips()
        self.tips = tips
        assert isinstance(self.tips, list)
        for e in self.tips:
            assert isinstance(e, (str, unicode))
        self.lasttip = None
        self.__random(content)  # show the first tip
        self.show_all()
Esempio n. 5
0
    def __init__(self):
        import gtk
        from support.releasenotesviewer import ReleaseNotesViewer
        gtk.Window.__init__(self)
        self.set_position(gtk.WIN_POS_CENTER)
        self.set_title(_('Tip of the Day'))
        self.set_border_width(10)
        
        title = gtk.Label ()
        title.set_markup ( _('<span size="x-large"><b>Did you know ?</b></span>') )
        title.set_alignment(0.5, 0.5)
        titlebox = gtk.HBox (False, 10)
        titlebox.pack_start (gtk.image_new_from_stock ( gtk.STOCK_DIALOG_INFO, 
                                                        gtk.ICON_SIZE_DIALOG ),
                             False, False, 0)
        titlebox.pack_start (title)

        content = ReleaseNotesViewer()
        gray_bg(content)
        content.set_cursor_visible(False)
        content.set_wrap_mode(gtk.WRAP_WORD)
        
        scroll_content = gtk.ScrolledWindow()
        scroll_content.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        scroll_content.add(content)
        scroll_content.set_size_request(-1, 200)

        close_button =  stock_image_only_button(gtk.STOCK_CLOSE )
        def close_me(w):
            self.destroy()
        close_button.connect( 'clicked', close_me )

        next_tip = stock_image_only_button(gtk.STOCK_GO_FORWARD)
        next_tip.connect ( 'clicked', self.__next_tip, content )
        next_tip.grab_focus()
        
        previous_tip = stock_image_only_button(gtk.STOCK_GO_BACK)
        previous_tip.connect ( 'clicked', self.__previous_tip, content )
        
        def show_submit_dialog(*w):
            from gae import ProposeLinuxSkillWindow
            ProposeLinuxSkillWindow()
        submit_skills = image_stock_button(gtk.STOCK_GO_UP, _('Submit Linux Skills'))
        submit_skills.connect('clicked', show_submit_dialog)
        
        show_all_tips = image_stock_button(gtk.STOCK_INDEX, _('Show all tips'))
        show_all_tips.connect('clicked', self.__show_all_tips)
        
        hbox = gtk.HBox(False, 10)
        hbox.pack_end(close_button, False, False)
        hbox.pack_end(next_tip, False, False)
        hbox.pack_end(previous_tip, False, False)
        hbox.pack_end(submit_skills, False, False)
        hbox.pack_end(show_all_tips, False, False)

        box = gtk.VBox ( False, 0 )
        box.pack_start ( titlebox, False )
        box.pack_start ( scroll_content, False )
        box.pack_start ( hbox, False )
        box.show_all()

        self.add(box)
        global tips
        if tips == None:
            import loader
            tips = loader.load_tips() 
        self.tips = tips
        assert isinstance(self.tips, list)
        for e in self.tips:
            assert isinstance(e, (str,unicode) )
        self.lasttip = None
        self.__random ( content ) # show the first tip
        self.show_all()