1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00
This commit is contained in:
Shlomi Fish 2017-04-17 12:56:14 +03:00
parent 4ce002d3ec
commit bfcfdc59a9
4 changed files with 40 additions and 52 deletions

View file

@ -24,10 +24,11 @@
__all__ = ['PlayerOptionsDialog']
# imports
import gobject, gtk
import gobject
import gtk
# PySol imports
from pysollib.mygettext import _, n_
from pysollib.mygettext import _
# Toolkit imports
from tkwidget import MfxDialog
@ -66,7 +67,8 @@ class PlayerOptionsDialog(MfxDialog):
top_box.pack_start(self.confirm_quit_check)
self.confirm_quit_check.set_active(app.opt.confirm != 0)
#
self.update_stats_check = gtk.CheckButton(_('Update statistics and logs'))
self.update_stats_check = gtk.CheckButton(
_('Update statistics and logs'))
self.update_stats_check.show()
top_box.pack_start(self.update_stats_check)
self.update_stats_check.set_active(app.opt.update_player_stats != 0)
@ -75,19 +77,17 @@ class PlayerOptionsDialog(MfxDialog):
self.show_all()
gtk.main()
def initKw(self, kw):
kwdefault(kw,
strings=(_('&OK'), _('&Cancel'),),
default=0,
#resizable=1,
# resizable=1,
padx=10, pady=10,
#width=600, height=400,
##~ buttonpadx=10, buttonpady=5,
# width=600, height=400,
# #~ buttonpadx=10, buttonpady=5,
)
return MfxDialog.initKw(self, kw)
def done(self, button):
self.button = button.get_data('user_data')
self.player = self.player_entry.get_text()
@ -95,6 +95,3 @@ class PlayerOptionsDialog(MfxDialog):
self.update_stats = self.update_stats_check.get_active()
self.win_animation = False
self.quit()

View file

@ -23,7 +23,8 @@
# imports
import os, sys
import os
import sys
import gtk
from gtk import gdk
@ -74,7 +75,7 @@ class PysolProgressBar:
self.pbar.show()
vbox.pack_start(self.pbar, True, False)
self.pbar.realize()
##~ self.pbar.set_show_text(show_text)
# ~ self.pbar.set_show_text(show_text)
self.pbar.set_text(str(show_text)+'%')
w, h = self.pbar.size_request()
self.pbar.set_size_request(max(w, 300), max(h, height))
@ -87,13 +88,13 @@ class PysolProgressBar:
im.set_property('xpad', 10)
im.set_property('ypad', 5)
# set icon
## if app:
## try:
## name = app.dataloader.findFile('pysol.xpm')
## bg = self.top.get_style().bg[gtk.STATE_NORMAL]
## pixmap, mask = create_pixmap_from_xpm(self.top, bg, name)
## self.top.set_icon(pixmap, mask)
## except: pass
# if app:
# try:
# name = app.dataloader.findFile('pysol.xpm')
# bg = self.top.get_style().bg[gtk.STATE_NORMAL]
# pixmap, mask = create_pixmap_from_xpm(self.top, bg, name)
# self.top.set_icon(pixmap, mask)
# except: pass
setTransient(self.top, parent)
self.top.show()
self.top.window.set_cursor(gdk.Cursor(gdk.WATCH))
@ -106,8 +107,8 @@ class PysolProgressBar:
pass
def update(self, percent=None, step=1):
##self.steps_sum += step
##print self.steps_sum, self.norm
# self.steps_sum += step
# print self.steps_sum, self.norm
step = step/self.norm
if percent is None:
self.percent += step
@ -134,7 +135,7 @@ class PysolProgressBar:
# *
# ************************************************************************
#%ifndef BUNDLE
# %ifndef BUNDLE
class TestProgressBar:
def __init__(self, parent, images=None):
@ -142,32 +143,35 @@ class TestProgressBar:
self.progress = PysolProgressBar(None, parent, title="Progress",
images=images, color='#008200')
self.progress.pack()
self.func = [ self.update, 0 ]
self.func[1] = timeout_add(30, self.func[0])
self.func = [self.update, 0]
# self.func[1] = timeout_add(30, self.func[0])
def update(self, *args):
if self.progress.percent >= 100:
self.progress.destroy()
mainquit()
# mainquit()
return False
self.progress.update(step=1)
return True
def progressbar_main(args):
root = gtk.Window()
root.connect("destroy", mainquit)
root.connect("delete_event", mainquit)
# root.connect("destroy", mainquit)
# root.connect("delete_event", mainquit)
images = None
if 1:
from tkwrap import loadImage
im = loadImage(os.path.join(os.pardir, os.pardir, 'data', 'images', 'jokers', 'joker07_40_774.gif'))
im = loadImage(os.path.join(
os.pardir, os.pardir, 'data', 'images', 'jokers',
'joker07_40_774.gif'))
images = (im, im)
pb = TestProgressBar(root, images=images)
main()
TestProgressBar(root, images=images)
# main()
return 0
if __name__ == '__main__':
sys.exit(progressbar_main(sys.argv))
#%endif
# %endif

View file

@ -23,8 +23,8 @@
# imports
import os, re, sys, types
import gtk, gobject
import gtk
import gobject
# PySol imports
@ -66,11 +66,9 @@ class PysolTreeView:
self._restoreSettings()
def _unrealizeEvent(self, w):
self._saveSettings()
def _saveSettings(self):
self._saveExpandedRows()
selection = self.treeview.get_selection()
@ -83,15 +81,14 @@ class PysolTreeView:
self._loadExpandedRows()
if self._selected_row:
selection = self.treeview.get_selection()
##selection.select_path(self._selected_row)
##selection.unselect_all()
# selection.select_path(self._selected_row)
# selection.unselect_all()
gobject.idle_add(selection.select_path, self._selected_row)
if self._vadjustment_position is not None:
##self.sw_vadjustment.set_value(self._vadjustment_position)
# self.sw_vadjustment.set_value(self._vadjustment_position)
gobject.idle_add(self.sw_vadjustment.set_value,
self._vadjustment_position)
def _saveExpandedRows(self):
treeview = self.treeview
PysolTreeView._expanded_rows = []
@ -103,7 +100,6 @@ class PysolTreeView:
for path in self._expanded_rows:
self.treeview.expand_to_path(path)
def getSelected(self):
selection = self.treeview.get_selection()
model, path = selection.get_selected_rows()
@ -113,15 +109,6 @@ class PysolTreeView:
index = model.get_value(iter, 1)
return index
def unselectAll(self):
selection = self.treeview.get_selection()
selection.unselect_all()

View file

@ -10,7 +10,7 @@ use String::ShellQuote qw/ shell_quote /;
# my $cmd = shell_quote( 'flake8', '.' );
my $cmd = shell_quote( 'flake8',
grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/*.py ./pysollib/[cm]*/*.py ./pysollib/pysolgtk/[a-m]*.py') );
grep { not($_ eq './pysollib/pysoltk.py') } glob('./pysollib/*.py ./pysollib/[cm]*/*.py ./pysollib/pysolgtk/[a-p]*.py') );
# TEST
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );