Closed GoogleCodeExporter closed 9 years ago
Hm. The thing is that the fileChooserButton is kinda strange. In order to make
it
select a file, you have to create a filechooser-dialog and associate with it.
You
must then select the file using the dialog.
I haven't been able to find other ways to do it.
On my system the file you want to open will be selected in the dialog. Isn't it
so on
your system?
Original comment by lobais
on 2 Jan 2008 at 3:52
There is two different problem here.
1. If i want to open a .pgn from my filesystem (in thunar or with command line
param), i get an extra gtk filechooser dialog, and i can select it from. This
case is
only inconvenient, as i once selected what i wanted.
2. When i click in a browser on a .pgn link, the dialog comes again, but of
course i
can't select the http://....pgn from it, so it fails to open.
Original comment by gbtami
on 2 Jan 2008 at 4:05
1) Yes. If you can find out how to do this better, tell me.
2) Eh, PyChess should be able to open from http using the System.protoopen
module. If
it doesn't - it's a bug.
Original comment by lobais
on 2 Jan 2008 at 4:28
Committed a possible fix in rev 822.
Original comment by gbtami
on 3 Jan 2008 at 8:28
So what you do is to assosiate an uri with the entire dialog.
Ugly as it is, it might be okay, and perhaps I can implement it more cleanly in
the
ionest rewrite I'm doing.
It still has some problems though. Besides the small oopses like you can no
longer
use the enterGameNotation dialog, the fileChooserButton still shows "None" on my
system, rather than the name of the file.
Original comment by lobais
on 3 Jan 2008 at 9:01
I think there are currently three ways to fix this:
1) Write a custom FileChooserButton that allows direct setting of URL
Pluses: Will potentially solve all problems
Minuses: It needs updating when gtk updates,
It might not even be possible, as when clicking it we need to also
select the file in the opendialog
2) Accept that the filechooserbutton has no value when starting from
commandline or
by drag'n'drop. Something like your fix.
Pluses: Not as much code has to be changed
Minuses: Doesn't fit so much into standard opening
3) Accept that the user has to select the file twice, however in a
filechooserdialog
that is already pointed at the file.
Pluses: Won't need any code changes at all,
The FileChooserButton will have a value, just like when Ctrl+O
Minuses: Extra clicks,
Kludgy
No matter which one we choose, we should send a bug report to gtk.
Original comment by lobais
on 3 Jan 2008 at 10:19
I'm reverting the fix until we know which route we are gonna take.
That also makes it easier to commit the ionest change :)
Btw. As written earlier my research on FileChooserButton hasn't shown any ideal
ways,
but perhaps you have some more ideas?
Original comment by lobais
on 4 Jan 2008 at 12:09
4) Don't use gtk.FileChooserButton on this sidepanel at all.
Just create a new gtk.FileChooserDialog to select a .pgn if menu was used for
opening
a game. If PyChess was started with a .pgn command line param, no file choser
needed.
Original comment by gbtami
on 4 Jan 2008 at 11:09
Oh yeah! Check out rev 827.
I looked into why I rejected the set_filename function in the first place. It
was
because the get_filename function didn't work when using it.
So, inspired by your work, I commited a change that makes the BoardPreview
remember
the filename, and therefor don't need get_filename.
I hope you like it.
Original comment by lobais
on 4 Jan 2008 at 5:45
I'm really happy that my ugly commit at least inspired your solution :)
1. Opening a game from menu: OK
2. PYTHONPATH=lib ./pychess /home/tamas/wchmex07.pgn
This opens a pgn as expected, but clicking on "Start game" doesn't start
anything.
3.tamas@tami:~/svn/pychess$ PYTHONPATH=lib ./pychess
http://www.chesscenter.com/twic/chrus07.pgn
/adat/svn/pychess/lib/pychess/widgets/BoardPreview.py:167: GtkWarning:
gtk_file_system_unix_get_parent: assertion `g_path_is_absolute (filename)'
failed
self.fcbutton.set_filename(filename)
Traceback (most recent call last):
File "/home/tamas/svn/pychess/lib/pychess/widgets/BoardPreview.py", line 112, in
on_file_activated
self.chessfile = chessfile = loader.load(protoopen("file://"+filename))
File "/home/tamas/svn/pychess/lib/pychess/System/protoopen.py", line 11, in protoopen
protocol, path = splitUri(uri)
ValueError: too many values to unpack
Original comment by gbtami
on 4 Jan 2008 at 9:04
Original comment by gbtami
on 4 Jan 2008 at 9:04
I've fixed 2.
As you've shown the http openthing doesn't really work. However I'm not sure
how to
integrate it in the filechooserbutton ;) so I'm thinking of just keeping opening
http's out of PyChess until we get gnomevfs support - hopefully in Stauton.
Original comment by lobais
on 5 Jan 2008 at 12:32
Committed a fix for 3. in rev 834.
I know it doesn't integrates in filechooserbutton, but seems working.
Original comment by gbtami
on 5 Jan 2008 at 6:08
Your fix looks good.
In staution GnomeVfs will hopefully make things more beutiful.
There seams to be a little problem when dragging in http uris.
(pychess:18058): libgnomevfs-CRITICAL **: gnome_vfs_get_uri_from_local_path:
assertion `g_path_is_absolute (local_full_path)' failed
Traceback (most recent call last):
File
"/home/thomas/Programmering/python/skak/trunk/lib/pychess/widgets/BoardPreview.p
y",
line 93, in on_file_activated
self.chessfile = chessfile = loader.load(protoopen(filename))
File
"/home/thomas/Programmering/python/skak/trunk/lib/pychess/System/protoopen.py",
line
21, in protoopen
raise IOError, "Protocol isn't supported by pychess"
IOError: Protocol isn't supported by pychess
Original comment by lobais
on 10 Jan 2008 at 7:14
What "dragging in http uris" exactly mean?
Original comment by gbtami
on 10 Jan 2008 at 7:44
1. open PyChess - PYTHONPATH=lib ./pychess
2. open Firefox at e.g. http://www.pgnmentor.com/files.html
3. in the bottom of the page you find a link directly to a pgn. e.g.
WorldChamp1886.pgn
4. Drag this link onto PyChess
Original comment by lobais
on 10 Jan 2008 at 8:34
Fixed in rev 848.
Original comment by gbtami
on 11 Jan 2008 at 8:24
With svn 864 loading games specified as command line parameter crashes PyChess
without any traceback.
Original comment by gbtami
on 16 Jan 2008 at 12:00
Original comment by gbtami
on 16 Jan 2008 at 4:42
Original issue reported on code.google.com by
gbtami
on 2 Jan 2008 at 1:50