def setupSysTrayIcon(self): self.statusIcon = gtk.StatusIcon() self.statusIcon.set_from_file('systray.png') self.statusIcon.set_tooltip('TodoIst.com') #self.clicked_menu.__dict__['mapped'] = False gtk.status_icon_position_menu(self.todoList, self.statusIcon) self.statusIcon.connect('button-press-event', self.sysTrayPress)
def Showm(self, widget): if os.path.exists('/tmp/look'): fl = open('/tmp/look', 'rb').read() os.kill(int(fl), 9) os.remove('/tmp/look') else: x, y, z = gtk.status_icon_position_menu(self.menu, self.tray) os.system('python ' + sys_inf.UPIM_PATH + 'Calendar.py ' + str(x) + ' ' + str(y) + ' &')
def __init__(self): #self.screen = None #self.root_win = None #self.rec = None #self.mapped = False #self.is_icon_on_top = True #self.press_event = None #self.last_tah_press_num = -1 #self.press_num = 0 #self.pressing = False gtk.gdk.event_handler_set(self.on_any_event) self.statusIcon = gtk.StatusIcon() self.statusIcon.set_from_stock(gtk.STOCK_CONNECT) self.clicked_menu = gtk.Menu() self.clicked_menu.__dict__['mapped'] = False self.clicked_menu.append(gtk.MenuItem('Clicked 1')) self.clicked_menu.show_all() gtk.status_icon_position_menu(self.clicked_menu, self.statusIcon)
def ShowMenu(self,widget): if self.show == False: #rootwin = self.hwg.window.get_screen().get_root_window() #x, y, mods = rootwin.get_pointer() x,y,z = gtk.status_icon_position_menu(self.m, self.tray) if self.hwg: if not self.hwg.window.window: if y < gtk.gdk.screen_height()/2: backend.save_setting('orientation', 'top') else: backend.save_setting('orientation', 'bottom') self.hwg.Adjust_Window_Dimensions(x,y) self.hwg.show_window() self.show = True else: self.HideMenu()
def __init__(self, statusIcon, menu, service, dropZones): self.service = service self.statusIcon = statusIcon self.dropZones = dropZones self.menu = menu self.w = gtk.Window() TARGET_TYPE_TEXT = 80 self.w.drag_dest_set( gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, [("text/uri-list", 0, TARGET_TYPE_TEXT)], gtk.gdk.ACTION_MOVE | gtk.gdk.ACTION_COPY) self.w.connect('drag_motion', self.motion_cb) self.w.connect('drag_drop', self.drop_cb) self.w.connect('drag_data_received', self.drop_data_received_cb) self.w.connect('destroy', self.destroy_cb) self.w.set_icon_from_file("/usr/lib/linuxmint/mintUpload/icon.svg") self.w.set_title(self.service['name']) self.w.set_keep_above(True) self.w.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY) self.w.set_skip_pager_hint(True) self.w.set_skip_taskbar_hint(True) self.w.stick() pos = gtk.status_icon_position_menu(self.menu, self.statusIcon) posY = len(self.dropZones) * 80 self.w.move(pos[0], pos[1] + 50 - posY) self.label = gtk.Label() self.label.set_text("<small>" + _("Drag & Drop here to upload to %s") % self.service['name'] + "</small>") self.label.set_line_wrap(True) self.label.set_use_markup(True) self.label.set_width_chars(20) self.w.add(self.label) self.w.set_default_size(100, 50) if self.w.is_composited(): self.w.set_opacity(0.5) self.w.show_all()
def trayPopup(self, sicon, button, etime): menu = gtk.Menu() if os.sep == '\\': setupMenuHideOnLeave(menu) items = self.getTrayPopupItems() # items.insert(0, self.getMainWinMenuItem())## FIXME geo = self.sicon.get_geometry() ## Returns None on windows, why??? if geo is None:## windows, taskbar is on buttom(below) items.reverse() get_pos_func = None else: y1 = geo[1][1] y = gtk.status_icon_position_menu(menu, self.sicon)[1] if y<y1:## taskbar is on bottom items.reverse() get_pos_func = gtk.status_icon_position_menu for item in items: menu.add(item) menu.show_all() menu.popup(None, None, get_pos_func, button, etime, self.sicon) ui.updateFocusTime()
def __init__(self, statusIcon, menu, service, dropZones): self.service = service self.statusIcon = statusIcon self.dropZones = dropZones self.menu = menu self.w = gtk.Window() TARGET_TYPE_TEXT = 80 self.w.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP, [ ( "text/plain", 0, TARGET_TYPE_TEXT ) ], gtk.gdk.ACTION_MOVE|gtk.gdk.ACTION_COPY) self.w.connect('drag_motion', self.motion_cb) self.w.connect('drag_drop', self.drop_cb) self.w.connect('drag_data_received', self.drop_data_received_cb) self.w.connect('destroy', self.destroy_cb) self.w.set_icon_from_file("/usr/lib/linuxmint/mintUpload/icon.svg") self.w.set_title(self.service['name']) self.w.set_keep_above(True) self.w.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_UTILITY) self.w.set_skip_pager_hint(True) self.w.set_skip_taskbar_hint(True) self.w.stick() pos = gtk.status_icon_position_menu(self.menu, self.statusIcon) posY = len(self.dropZones) * 80 self.w.move(pos[0], pos[1] + 50 - posY) self.label = gtk.Label() self.label.set_text("<small>" + _("Drag & Drop here to upload to %s") % self.service['name'] + "</small>") self.label.set_line_wrap(True) self.label.set_use_markup(True) self.label.set_width_chars(20) self.w.add(self.label) self.w.set_default_size(100, 50) if self.w.is_composited(): self.w.set_opacity(0.5) self.w.show_all()
def get_menu_position(self, menu, icon): return gtk.status_icon_position_menu(menu, icon)
def menu_pos(self, menu): return gtk.status_icon_position_menu(self.menu, self.statusIcon)
def menu_action(self,icon,button,times): x,y,z=gtk.status_icon_position_menu(self.menu,icon) self.item_factory.popup(x, y,button, times)
def pos(menu): return (gtk.status_icon_position_menu(menu, icon))
def get_menu_position(self, menu, icon): """ Returns coordinates for the best menu position """ return gtk.status_icon_position_menu(menu, icon)
def __show_message(self, title, message): menu = gtk.Menu() (x, y, p) = gtk.status_icon_position_menu(menu, self) self.notification_service.Notify("", 12, "", title, message, list(), {'x': x, 'y': y}, -1)
def __position(self, menu): return gtk.status_icon_position_menu(menu, self.ui_statusicon)
def move (w, icon): r = gtk.status_icon_position_menu (gtk.Menu (), icon) w.move (r[0], r[1])