Merge branch 'master' of git://repo.or.cz/fpbd-bostik

This commit is contained in:
Worros 2010-08-21 22:08:16 +08:00
commit 66e22e45f5
6 changed files with 5411 additions and 1638 deletions

View File

@ -525,7 +525,10 @@ class Hud:
def debug_stat_windows(self, *args): def debug_stat_windows(self, *args):
# print self.table, "\n", self.main_window.window.get_transient_for() # print self.table, "\n", self.main_window.window.get_transient_for()
for w in self.stat_windows: for w in self.stat_windows:
try:
print self.stat_windows[w].window.window.get_transient_for() print self.stat_windows[w].window.window.get_transient_for()
except AttributeError:
print "this window doesnt have get_transient_for"
def save_layout(self, *args): def save_layout(self, *args):
new_layout = [(0, 0)] * self.max new_layout = [(0, 0)] * self.max

View File

@ -1093,6 +1093,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
self.status_bar = None self.status_bar = None
self.quitting = False self.quitting = False
self.visible = False
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event) self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy) self.window.connect("destroy", self.destroy)
@ -1130,6 +1131,7 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
self.tab_main_help(None, None) self.tab_main_help(None, None)
self.window.show() self.window.show()
self.visible = True # Flip on
self.load_profile(create_db = True) self.load_profile(create_db = True)
if not options.errorsToConsole: if not options.errorsToConsole:
@ -1165,21 +1167,31 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
self.window.connect('window-state-event', self.window_state_event_cb) 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):
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) def __iconify(self):
self.visible = False
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
self.window.hide()
self.window.set_skip_taskbar_hint(True) self.window.set_skip_taskbar_hint(True)
self.window.set_skip_pager_hint(True) self.window.set_skip_pager_hind(True)
else:
def __deiconify(self):
self.visible = True
self.window.set_skip_taskbar_hint(False) self.window.set_skip_taskbar_hint(False)
self.window.set_skip_pager_hint(False) self.window.set_skip_pager_hind(False)
def window_state_event_cb(self, window, event):
# Deal with iconification first
if event.changed_mask & gtk.gdk.WINDOW_STATE_ICONIFIED:
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
self.__iconify()
else:
self.__deiconify()
if not event.new_window_state & gtk.gdk.WINDOW_STATE_WITHDRAWN:
return True
# And then the tray icon click
if event.new_window_state & gtk.gdk.WINDOW_STATE_WITHDRAWN:
self.__iconify()
else:
self.__deiconify()
# Tell GTK not to propagate this signal any further # Tell GTK not to propagate this signal any further
return True return True
@ -1197,11 +1209,9 @@ You can find the full license texts in agpl-3.0.txt, gpl-2.0.txt, gpl-3.0.txt an
def statusicon_activate(self, widget, data = None): def statusicon_activate(self, widget, data = None):
# Let's allow the tray icon to toggle window visibility, the way # Let's allow the tray icon to toggle window visibility, the way
# most other apps work # most other apps work
shown = self.window.get_property('visible') if self.visible:
if shown:
self.window.hide() self.window.hide()
else: else:
self.window.show()
self.window.present() self.window.present()
def info_box(self, str1, str2): def info_box(self, str1, str2):