Compare commits
2 Commits
master
...
gtk-status
Author | SHA1 | Date | |
---|---|---|---|
e6f4038fb5 | |||
6fc219338f |
4
README.txt
Normal file
4
README.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
Pinger.py -- A ping tool that sits in your system tray
|
||||
|
||||
+ Saves your sanity when the wifi sucks
|
||||
+ Doesn't clutter up your screen with ping windows
|
BIN
activity.png
Normal file
BIN
activity.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -26,7 +26,6 @@
|
|||
#
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import AppIndicator3 as appindicator
|
||||
|
||||
# Timer
|
||||
from gi.repository import GObject as gobject
|
||||
|
@ -52,7 +51,8 @@ class HelloWorld:
|
|||
else:
|
||||
m = re.search('time=(.*) ms', out)
|
||||
label = m.group(1)+" ms"
|
||||
ind.set_label (label, "100.0 ms")
|
||||
#ind.set_label (label, "100.0 ms")
|
||||
status.set_title(label)
|
||||
#self.ping_menu_item.set_label(out)
|
||||
gobject.timeout_add_seconds(self.timeout, self.ping)
|
||||
|
||||
|
@ -85,13 +85,17 @@ def create_menu_item(menu, text, callback):
|
|||
return menu_items
|
||||
|
||||
if __name__ == "__main__":
|
||||
ind = appindicator.Indicator.new (
|
||||
"pinger",
|
||||
"", #indicator-messages
|
||||
appindicator.IndicatorCategory.COMMUNICATIONS)
|
||||
ind.set_status (appindicator.IndicatorStatus.ACTIVE)
|
||||
status = Gtk.StatusIcon()
|
||||
status.set_title("0.0 ms")
|
||||
status.set_from_stock(Gtk.STOCK_HOME)
|
||||
status.connect("activate",Gtk.Window.present)
|
||||
#ind = appindicator.Indicator.new (
|
||||
# "pinger",
|
||||
# "", #indicator-messages
|
||||
# appindicator.IndicatorCategory.COMMUNICATIONS)
|
||||
#ind.set_status (appindicator.IndicatorStatus.ACTIVE)
|
||||
#ind.set_attention_icon ("indicator-messages-new")
|
||||
ind.set_label ("0.0 ms", "100.0 ms")
|
||||
#ind.set_label ("0.0 ms", "100.0 ms")
|
||||
|
||||
# create a menu
|
||||
menu = Gtk.Menu()
|
||||
|
@ -104,7 +108,7 @@ if __name__ == "__main__":
|
|||
create_menu_item(menu, "Exit", hello.destroy)
|
||||
|
||||
# Add the menu to our statusbar
|
||||
ind.set_menu(menu)
|
||||
#ind.set_menu(menu)
|
||||
|
||||
# Runtime loop
|
||||
Gtk.main()
|
||||
|
|
32
new_gtk.py
Normal file
32
new_gtk.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
import gtk
|
||||
|
||||
class Main(gtk.Window):
|
||||
|
||||
def __init__(self):
|
||||
super(Main, self).__init__()
|
||||
self.connect('delete-event', self.on_delete_event)
|
||||
self.set_title("Virtual Machine Monitor")
|
||||
self.set_position(gtk.WIN_POS_CENTER)
|
||||
self.set_default_size(640,600)
|
||||
self.set_geometry_hints(min_width=640, min_height=600)
|
||||
self.set_icon_from_file("activity.png")
|
||||
#menubar = self.add_menubar()
|
||||
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file_at_size("activity.png",25,25)
|
||||
statusicon = gtk.StatusIcon()
|
||||
statusicon.set_title("0.0 ms")
|
||||
statusicon = gtk.status_icon_new_from_pixbuf(pixbuf)
|
||||
statusicon.connect("activate",self.tray_activate)
|
||||
self.show_all()
|
||||
|
||||
def on_delete_event(self, widget, event):
|
||||
self.hide()
|
||||
return True
|
||||
|
||||
def tray_activate(self, widget):
|
||||
self.present()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
Main()
|
||||
gtk.main()
|
Loading…
Reference in New Issue
Block a user