Commit 24ddf51e authored by Gaute Hope's avatar Gaute Hope

applet functions implemented

parent 19b0125d
2005-08-25 Gaute Hope <eg@gaute.vetsj.com>
* panel functions implemented
* servers/Makefile.am, confiugre.ac: changed behaviour a bit
* servers/GNOME_schedule.server.in.in: rm
* servers/GNOME_schedule.server.in: add
2005-08-24 Gaute Hope <eg@gaute.vetsj.com>
* src/applet.py: rm
......
......@@ -84,4 +84,5 @@ po/Makefile.in
desktop/Makefile
desktop/gnome-schedule.desktop
servers/Makefile
servers/GNOME_schedule.server
])
......@@ -21,7 +21,7 @@
<oaf_attribute name="name" type="string" value="Gnome schedule"/>
<oaf_attribute name="description" type="string" value="Configuration tool for your scheduled jobs"/>
<oaf_attribute name="panel:category" type="string" value="System tools"/>
<oaf_attribute name="panel:icon" type="string" value="bug-buddy.png"/>
<oaf_attribute name="panel:icon" type="string" value="@prefix@/share/pixmaps/gnome-schedule.png"/>
</oaf_server>
</oaf_info>
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_schedule.server.in
server_DATA = $(server_in_files:.server.in=.server)
$(server_in_files): $(server_in_files:.server.in=.server.in.in)
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
server_DATA = GNOME_schedule.server
@INTLTOOL_SERVER_RULE@
DISTCLEANFILES = $(server_DATA)
EXTRA_DIST = $(server_in_files)
EXTRA_DIST = $(server_DATA)
......@@ -39,13 +39,14 @@ class AddWindow:
self.at_radio = self.xml.get_widget("at_radio")
self.crontab_radio = self.xml.get_widget("crontab_radio")
self.crontab_radio.set_active (True)
def ShowAddWindow (self):
self.widget.set_transient_for(self.ParentClass.widget)
self.widget.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
self.widget.show_all()
print self.widget
def on_cancel_button_clicked (self, *args):
self.widget.hide()
......
<popup name="button3">
<menuitem name="show_main" verb="show_main" _label="_Show mainwindow" pixtype="stock" pixname="gtk-properties"/>
<menuitem name="add" verb="add" _label="_Add a task" pixtype="stock" pixname="gnome-stock-add"/>
<menuitem name="quit" verb="quit" _label="_Quit" pixtype="stock" pixname="gnome-stock-exit" />
<menuitem name="show_main" verb="show_main" _label="_Manage tasks" pixtype="stock" pixname="gtk-properties"/>
<menuitem name="add" verb="add" _label="_Add a task" pixtype="stock" pixname="gtk-new"/>
<menuitem name="help" verb="help" _label="_Help" pixtype="stock" pixname="gtk-help" />
<menuitem name="about" verb="about" _label="A_bout" pixtype="stock" pixname="gtk-about" />
</popup>
......@@ -45,8 +45,9 @@ gtk.glade.bindtextdomain(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR())
## The MainWindow class
##
class main:
def __init__(self, debug_flag=None):
def __init__(self, debug_flag=None, inapplet=False):
self.debug_flag = debug_flag
self.inapplet = inapplet
self.__loadIcon__()
self.__loadGlade__()
......@@ -175,7 +176,8 @@ class main:
self.schedule_reload ("all")
gtk.main()
if inapplet == False:
gtk.main()
......@@ -273,6 +275,7 @@ class main:
self.xml = gtk.glade.XML (config.getGladedir() + "/gnome-schedule.glade", domain="gnome-schedule")
except:
print "ERROR: Could not load glade file"
def __initUser__(self):
......@@ -518,5 +521,9 @@ class main:
#quit program
def __quit__(self, *args):
gtk.main_quit ()
if self.inapplet:
self.widget.hide()
else:
gtk.main_quit ()
......@@ -21,21 +21,29 @@
#python modules
import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
import gnome
import gnome.ui
import gnome.applet
import gobject
import sys
import signal
import os
import config
import mainWindow
class ScheduleApplet(gnome.applet.Applet):
def __init__(self, applet, iid):
self.__gobject_init__()
import gettext
gettext.install(config.GETTEXT_PACKAGE(), config.GNOMELOCALEDIR(), unicode=1)
......@@ -71,6 +79,8 @@ class ScheduleApplet(gnome.applet.Applet):
self.applet.show_all()
self.main_loaded = False
def __loadIcon__(self):
if os.access("../pixmaps/gnome-schedule.png", os.F_OK):
......@@ -98,7 +108,8 @@ class ScheduleApplet(gnome.applet.Applet):
def create_menu(self):
self.verbs = [ ("show_main", self.show_main_window),
("add", self.add_task),
("quit", self.cleanup)
("help", self.show_help),
("about", self.show_about)
]
self.propxml = self.read_xml()
self.applet.setup_menu(self.propxml, self.verbs, None)
......@@ -108,15 +119,32 @@ class ScheduleApplet(gnome.applet.Applet):
def show_main_window(self, widget, event):
print "show mainwindow"
def add_task(self, widget, event):
print "add a task"
def cleanup(self,event):
del self.applet
def show_main_window(self, *args):
if self.main_loaded == False:
self.main_loaded = True
self.main_window = mainWindow.main(None, True)
else:
self.main_window.schedule_reload("all")
self.main_window.widget.show()
def add_task(self, *args):
if self.main_loaded == False:
self.show_main_window()
self.main_window.widget.hide()
self.main_window.on_add_scheduled_task_menu_activate()
def show_help(self, *args):
if self.main_loaded == False:
self.show_main_window()
self.main_window.widget.hide()
self.main_window.on_manual_menu_activate()
def show_about(self, *args):
if self.main_loaded == False:
self.show_main_window()
self.main_window.widget.hide()
self.main_window.on_about_menu_activate()
gobject.type_register(ScheduleApplet)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment