def __init__(self, me, head, text): global xxx, yyy, slist self.head = head self.me = me self.text = text www = Gdk.Screen.width() hhh = Gdk.Screen.height() self.window = window = Gtk.Window(Gtk.WindowType.TOPLEVEL) #self.window = window = Gtk.Window(Gtk.WindowType.POPUP) window.set_default_size(10, 10) window.set_decorated(False) # That wat the window manager will not list it window.set_type_hint(Gdk.WindowTypeHint.UTILITY) #window.set_type_hint(Gdk.WindowTypeHint.DIALOG) #window.set_type_hint(Gdk.WindowTypeHint.TOOLBAR) window.set_events(Gdk.EventMask.POINTER_MOTION_MASK | Gdk.EventMask.POINTER_MOTION_HINT_MASK | Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.KEY_PRESS_MASK | Gdk.EventMask.KEY_RELEASE_MASK | Gdk.EventMask.FOCUS_CHANGE_MASK) window.set_accept_focus(False) window.connect("key-press-event", self.key_press_event) window.connect("button-press-event", self.area_button) #window.connect("motion-notify-event", self.area_motion) #window.connect("destroy", self.OnExit) #window.connect("event", self.OnExit) window.set_flags(Gtk.SENSITIVE) #window.set_flags(Gtk.CAN_FOCUS | Gtk.SENSITIVE) #window.set_flags(Gtk.CAN_FOCUS | Gtk.CAN_DEFAULT| Gtk.SENSITIVE | Gtk.PARENT_SENSITIVE) window.set_destroy_with_parent(True) window.set_transient_for(me) self.sticky = stickDoc(self, head, text) window.add(self.sticky) window.show_all() usleep(1) # Present window #window.show_all() #usleep(1) # Present window #Gdk.Window.set_skip_pager_hint(window.get_window(), True ) #Gdk.Window.set_skip_taskbar_hint(window.get_window(), True ) #window.set_keep_above(False) #Gdk.Window.set_decorations(window.get_window(), Gdk.DECOR_BORDER) if Gdk.Display.supports_composite(Gdk.Display.get_default()): Gdk.Window.set_composited(window.get_window(), True) Gdk.Window.set_opacity(window.get_window(), .5) # Arrange it in peace '''yyy = TOPSTOP; xxx = www / 2 for ww in slist.data: xx, yy = Gdk.Window.get_position(ww.window.get_window()) ww, hh = Gdk.Window.get_size(ww.window.get_window()) print "setting position", xx, yy, "size", ww, hh if yyy + hh >= hhh - 2 * BUTSTOP: xxx += 200 yyy = TOPSTOP if xxx > www - 100: xxx = TOPSTOP else: yyy += hh + 4 ''' #print xxx, yyy window.move(xxx, yyy) self.window.xx = xxx self.window.yy = yyy slist.add(self) global stickdb stickdb = pysql.sticksql(config_dir + "/data")
global mainwin, stickdb autohide = False try: if not os.path.isdir(config_dir): os.mkdir(config_dir) except: pass # Let the user know it needs fixin' if not os.path.isdir(config_dir): print "Cannot access config dir:", config_dir sys.exit(1) stickdb = pysql.sticksql(config_dir + "/data") # For testing rr = stickdb.rmall() for bb in range(8): stickdb.put("Hello Sticky %d" % bb, "This is a sticky test body %s" % bb) opts = [] args = [] try: opts, args = getopt.getopt(sys.argv[1:], "hva") except getopt.GetoptError, err: print "Invalid option(s) on command line:", err sys.exit(1)