def done_dlg(self, dlg): global window2, stickdb head = dlg.head.get_text() buff = dlg.text.get_buffer() ss = buff.get_start_iter(); ee = buff.get_end_iter() text = buff.get_text(ss, ee) #print "done_dlg", head, text stickdb.put(head, text) stickdb.putshow(head, 1) found = False for aa in yellow.slist.data: if aa.head == xstr: found = True print "update", head, text aa.head = head aa.text = text aa.window.head = head aa.window.text = text aa.invalidate() yellow.usleep(1) aa.window.show() if not found: print "creating", head cc = yellow.stickWin(window2, head, text) pp = stickdb.getpos(head) if pp: cc.window.xx = pp[0]; cc.window.yy = pp[1] aa.window.move(aa.window.xx, aa.window.yy) self.window.present()
def show_one(self, area, me): global xstr # Already Shown? found = False for aa in yellow.slist.data: if aa.head == xstr: found = True aa.window.move(aa.window.xx, aa.window.yy) aa.window.present() #aa.window.set_keep_above(True) yellow.usleep(1) if not found: rr = stickdb.get(xstr) if rr: aa = yellow.stickWin(window2, rr[1], rr[2]) stickdb.putshow(aa.head, 1) stickdb.putpos(aa.head, aa.window.xx, aa.window.yy)
def show_all_sticks(self, area, me): rr = stickdb.getheads() for bb in rr: if stickdb.getshow(bb[0]): found = False for aa in yellow.slist.data: if aa.head == bb[0]: found = True tt = stickdb.getpos(aa.head) if tt: aa.window.xx = tt[0]; aa.window.yy = tt[1] aa.window.move(aa.window.xx, aa.window.yy) aa.window.present() yellow.usleep(1) break if not found: ss = stickdb.get(bb[0]) if ss: aa = yellow.stickWin(window2, ss[1], ss[2])
# W2 global window2 window2 = Gtk.Window(Gtk.WindowType.TOPLEVEL) window2.set_title("Python Nowin") window2.set_position(Gtk.WindowPosition.CENTER) #window2.connect("key-press-event", key_press_event) window2.mainwin = mainwin heads = [] rr = stickdb.getheads() for aa in rr: heads.append(aa[0]) if stickdb.getshow(aa[0]): ss = stickdb.get(aa[0]) yellow.stickWin(window2, ss[1], ss[2]) mainwin.tree.update_treestore(heads) for aa in rr: if stickdb.getshow(aa[0]): tt = stickdb.getpos(aa[0]) for bb in yellow.slist.data: if aa[0] == bb.head: bb.window.move(tt[0], tt[1]) window2.show_all() window2.hide() mainwin.window.show_all() if autohide:
window.set_flags(Gtk.CAN_FOCUS | Gtk.SENSITIVE) 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.connect("destroy", OnExit) window.connect("key-press-event", key_press_event) window.connect("button-press-event", area_button) for aa in range(5): zz = yellow.stickWin(window, "Hello World", "This is a small sticky %d" % aa) yy = yellow.stickWin( window, "Hello World", "This is a sticky\n" "With new longer and longer and longer and longer and longer and longer and longer lines\n" "Done.") #for aa in range(200): for aa in range(20): zz = yellow.stickWin(window, "Hello World2", "This is a small sticky %d" % aa) window.show_all() Gtk.main()