Merge branch 'master' of git://git.assembla.com/fpdb-eric

This commit is contained in:
Mika Bostrom 2009-10-26 12:12:56 +02:00
commit 70426a70a0
2 changed files with 61 additions and 12 deletions

View File

@ -116,11 +116,7 @@ class HUD_main(object):
# called by an event in the HUD, to kill this specific HUD # called by an event in the HUD, to kill this specific HUD
if table in self.hud_dict: if table in self.hud_dict:
self.hud_dict[table].kill() self.hud_dict[table].kill()
try: self.hud_dict[table].main_window.destroy()
# throws exception in windows sometimes (when closing using main_window menu?)
self.hud_dict[table].main_window.destroy()
except:
pass
self.vb.remove(self.hud_dict[table].tablehudlabel) self.vb.remove(self.hud_dict[table].tablehudlabel)
del(self.hud_dict[table]) del(self.hud_dict[table])
self.main_window.resize(1,1) self.main_window.resize(1,1)
@ -131,7 +127,7 @@ class HUD_main(object):
def idle_func(): def idle_func():
gtk.gdk.threads_enter() gtk.gdk.threads_enter()
try: try: # TODO: seriously need to decrease the scope of this block.. what are we expecting to error?
newlabel = gtk.Label("%s - %s" % (table.site, table_name)) newlabel = gtk.Label("%s - %s" % (table.site, table_name))
self.vb.add(newlabel) self.vb.add(newlabel)
newlabel.show() newlabel.show()
@ -174,12 +170,13 @@ class HUD_main(object):
# function idle_func() to be run by the gui thread, at its leisure. # function idle_func() to be run by the gui thread, at its leisure.
def idle_func(): def idle_func():
gtk.gdk.threads_enter() gtk.gdk.threads_enter()
try: # try:
self.hud_dict[table_name].update(new_hand_id, config) self.hud_dict[table_name].update(new_hand_id, config)
[aw.update_gui(new_hand_id) for aw in self.hud_dict[table_name].aux_windows] [aw.update_gui(new_hand_id) for aw in self.hud_dict[table_name].aux_windows]
return False # finally:
finally: gtk.gdk.threads_leave()
gtk.gdk.threads_leave() return False
gobject.idle_add(idle_func) gobject.idle_add(idle_func)
def read_stdin(self): # This is the thread function def read_stdin(self): # This is the thread function

View File

@ -41,6 +41,10 @@ if os.name == 'nt' and sys.version[0:3] not in ('2.5', '2.6') and '-r' not in sy
else: else:
pass pass
#print "debug - not changing path" #print "debug - not changing path"
if os.name == 'nt':
import win32api
import win32con
print "Python " + sys.version[0:3] + '...\n' print "Python " + sys.version[0:3] + '...\n'
@ -618,7 +622,55 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt")
self.window.show() self.window.show()
self.load_profile() self.load_profile()
self.statusIcon = gtk.StatusIcon()
self.statusIcon.set_from_stock(gtk.STOCK_HOME)
self.statusIcon.set_tooltip("Free Poker Database")
self.statusIcon.connect('activate', self.statusicon_activate)
self.statusMenu = gtk.Menu()
menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT)
menuItem.connect('activate', self.dia_about)
self.statusMenu.append(menuItem)
menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menuItem.connect('activate', self.quit)
self.statusMenu.append(menuItem)
self.statusIcon.connect('popup-menu', self.statusicon_menu, self.statusMenu)
self.statusIcon.set_visible(True)
self.window.connect('window-state-event', self.window_state_event_cb)
sys.stderr.write("fpdb starting ...") sys.stderr.write("fpdb starting ...")
def window_state_event_cb(self, window, event):
print "window_state_event", event
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
# -20 = GWL_EXSTYLE can't find it in the pywin32 libs
#bits = win32api.GetWindowLong(self.window.window.handle, -20)
#bits = bits ^ (win32con.WS_EX_TOOLWINDOW | win32con.WS_EX_APPWINDOW)
#win32api.SetWindowLong(self.window.window.handle, -20, bits)
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
self.window.hide()
self.window.set_skip_taskbar_hint(True)
self.window.set_skip_pager_hint(True)
else:
self.window.set_skip_taskbar_hint(False)
self.window.set_skip_pager_hint(False)
def statusicon_menu(self, widget, button, time, data = None):
# we don't need to pass data here, since we do keep track of most all
# our variables .. the example code that i looked at for this
# didn't use any long scope variables.. which might be an alright
# idea too sometime
if button == 3:
if data:
data.show_all()
data.popup(None, None, None, 3, time)
pass
def statusicon_activate(self, widget, data = None):
self.window.show()
self.window.present()
def warning_box(self, str, diatitle="FPDB WARNING"): def warning_box(self, str, diatitle="FPDB WARNING"):
diaWarning = gtk.Dialog(title=diatitle, parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK)) diaWarning = gtk.Dialog(title=diatitle, parent=None, flags=0, buttons=(gtk.STOCK_OK,gtk.RESPONSE_OK))