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 hide_one(self, area, me): global xstr for aa in yellow.slist.data: if aa.head == xstr: aa.window.hide() yellow.usleep(1) stickdb.putshow(aa.head, 0) #print "hide", aa.head, stickdb.getshow(aa.head) me.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])