def __init__(self, window, terminal):
self.window = window
self.window.set_size_request(652, 447)
self.window.set_position(gtk.WIN_POS_CENTER)
self.window.connect('delete-event',self.delete_event)
self.terminal = terminal
for cmd in ('python2.7', 'python27', 'python2'):
if os.system('which %s' % cmd) == 0:
self.command[1] = cmd
break
self.window.add(terminal)
self.childpid = self.terminal.fork_command(self.command[0], self.command, os.getcwd())
if self.childpid > 0:
self.childexited = self.terminal.connect('child-exited', self.on_child_exited)
self.window.connect('delete-event', lambda w, e: gtk.main_quit())
else:
self.childexited = None
spawn_later(0.5, self.show_startup_notify)
if should_visible():
self.window.show_all()
logo_filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'goagent-logo.png')
if not os.path.isfile(logo_filename):
with open(logo_filename, 'wb') as fp:
fp.write(base64.b64decode(GOAGENT_LOGO_DATA))
self.window.set_icon_from_file(logo_filename)
if appindicator:
self.trayicon = appindicator.Indicator('XX-Mini', 'indicator-messages', appindicator.CATEGORY_APPLICATION_STATUS)
self.trayicon.set_status(appindicator.STATUS_ACTIVE)
self.trayicon.set_attention_icon('indicator-messages-new')
self.trayicon.set_icon(logo_filename)
self.trayicon.set_menu(self.make_menu())
else:
self.trayicon = gtk.StatusIcon()
self.trayicon.set_from_file(logo_filename)
self.trayicon.connect('popup-menu', lambda i, b, t: self.make_menu().popup(None, None, gtk.status_icon_position_menu, b, t, self.trayicon))
self.trayicon.connect('activate', self.show_hide_toggle)
self.trayicon.set_tooltip('XX-Mini')
self.trayicon.set_visible(True)
评论列表
文章目录