ralsina / marave

Automatically exported from code.google.com/p/marave
GNU General Public License v2.0
0 stars 2 forks source link

Problem with Save dialog in Ubuntu #91

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open marave
2. Write something
3. Attempt to save

What is the expected output? What do you see instead?
The Save As dialog appears blank.

What version of the product are you using? On what operating system?
Linux tarantino 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 
i686 GNU/Linux

Marave r456 

Please provide any additional information below.

stdout:

elbarto@tarantino:~/marave-read-only$ marave
Using canvas editor
<module 'marave' from 
'/usr/local/lib/python2.6/dist-packages/marave/__init__.pyc'>
<module 'marave' from 
'/usr/local/lib/python2.6/dist-packages/marave/__init__.pyc'>
<module 'marave' from 
'/usr/local/lib/python2.6/dist-packages/marave/__init__.pyc'>
<module 'marave' from 
'/usr/local/lib/python2.6/dist-packages/marave/__init__.pyc'>
Cannot open file 
'/usr/local/lib/python2.6/dist-packages/marave/plugins/icons/configure.svg', 
because: No such file or directory
Cannot open file 
'/usr/local/lib/python2.6/dist-packages/marave/plugins/icons/configure.svg', 
because: No such file or directory
Cannot open file 
'/usr/local/lib/python2.6/dist-packages/marave/plugins/icons/configure.svg', 
because: No such file or directory
Cannot open file 
'/usr/local/lib/python2.6/dist-packages/marave/plugins/icons/configure.svg', 
because: No such file or directory
Disabling spellchecker
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/marave/main.py", line 933, in close
    self.beep.stop()
AttributeError: 'NoneType' object has no attribute 'stop'

Original issue reported on code.google.com by andresgattinoni on 4 Aug 2010 at 6:52

Attachments:

GoogleCodeExporter commented 9 years ago
With the Open dialog it happen's something similar. It shows just a part of the 
dialog.

Original comment by andresgattinoni on 4 Aug 2010 at 7:00

Attachments:

GoogleCodeExporter commented 9 years ago
The problem seems not to be in the marave application, but in the PyQt/QT 
version included in Ubuntu... I came to spelltextedit.py:179 and nothing seems 
to avoid the problem...

fname=unicode(QtGui.QFileDialog.getSaveFileName(self.parent(), self.tr("Save 
as"), self.lastFolder))

I searched through the web and nobody appears to get the same bad behavior... 
:-/

Original comment by fernandezm on 4 Aug 2010 at 7:12

GoogleCodeExporter commented 9 years ago
What happens if instead of self.parent() you use None?

Original comment by roberto.alsina on 4 Aug 2010 at 7:18

GoogleCodeExporter commented 9 years ago
I guess this issue should be merged with issue #85

Original comment by andresgattinoni on 5 Aug 2010 at 11:53

GoogleCodeExporter commented 9 years ago
BTW, I tried changing self.parent() to None on spelltextedit.py:179 and it's 
the same.

Original comment by andresgattinoni on 5 Aug 2010 at 11:59

GoogleCodeExporter commented 9 years ago
I have the same problem. Curiously, everything seems to work fine (i.e., the 
dialog shows and can be interacted with; I didn't proceed any further) if one 
uses an explicitly constructed QFileDialog, e.g.
    dlg = QtGui.QFileDialog(self.parent(), self.tr("Save as"), self.lastFolder)
    dlg.exec_()
Instead of QtGui.QFileDialog.getSaveFileName. A little more work may be 
necessary (e.g., properly setting some options, retrieving the filename, etc.), 
but it should work.
BTW: The same thing happens/applies to the open dialog.

Original comment by st.loeffler on 5 Aug 2010 at 1:58

GoogleCodeExporter commented 9 years ago
@6 awesome! Could you check if r460 works for "save as"? If it does, I'll 
change the rest immediately.

Original comment by roberto.alsina on 5 Aug 2010 at 2:32

GoogleCodeExporter commented 9 years ago
It works better for me, but there are some errors.
- Now the dialog shows correctly
- Minor issue: the confirmation button says "Open" instead of "Save"
- Bigger issue: it doesn't save the file.

Here is the output:

elbarto@tarantino:~/marave-read-only$ python marave-editor
Using canvas editor
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
Disabling spellchecker
Traceback (most recent call last):
  File "/home/elbarto/marave-read-only/marave/editor/spelltextedit.py", line 188, in saveas
    if fname:
UnboundLocalError: local variable 'fname' referenced before assignment
QWidget::setWindowModified: The window title does not contain a '[*]' 
placeholder
FNAME: /home/elbarto/test.txt

Original comment by andresgattinoni on 5 Aug 2010 at 2:35

GoogleCodeExporter commented 9 years ago
One more time with r461 :-)

Original comment by roberto.alsina on 5 Aug 2010 at 2:42

GoogleCodeExporter commented 9 years ago
Now the button says "Save" and it doesn't throw the exception. But it still 
shows an error saying that the file couldn't be saved. Actually the file is 
created but empty.

I'm also still getting a segfault when I quit.

elbarto@tarantino:~/marave-read-only$ python marave-editor
Using canvas editor
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
Disabling spellchecker
FNAME: /home/elbarto/test.txt
Segmentation fault

Original comment by andresgattinoni on 5 Aug 2010 at 2:46

GoogleCodeExporter commented 9 years ago
Hmmm... could you try debugging marave.editor.spelltextedit.save and see where 
the exception happens?

Original comment by roberto.alsina on 5 Aug 2010 at 2:51

GoogleCodeExporter commented 9 years ago
Same here. Note that it's the Qt dialog, not the native one (which may or may 
not be the wanted effect)

re. "Open" instead of "Save": I believe
    fdialog.setAcceptMode(QtGui.QFileDialog.AcceptSave)
solves this (and maybe sets some other internal flags properly)
Note that fname should be initialized to None at the beginning of saveas(), or 
else "if fname" might raise an exception when the user aborts the dialog

re. failing to save: I narrowed down the problem to the line
    encoded = unicode(self.toPlainText()).encode(unicode(stream.codec().name()))
in save(). stream.codec().name() returns "System" for some reason, which 
apparently is no valid python codec name. I'd suggest to do the whole writting 
via "stream", which is designed specifically for encoding the string correctly. 
I don't know how to use "<<" in python, though

Original comment by st.loeffler on 5 Aug 2010 at 2:53

GoogleCodeExporter commented 9 years ago
I commented the big try/except in the save method and here's the exception:

Traceback (most recent call last):
  File "/home/elbarto/marave-read-only/marave/editor/spelltextedit.py", line 193, in saveas
    self.save()
  File "/home/elbarto/marave-read-only/marave/editor/spelltextedit.py", line 160, in save
    encoded = unicode(self.toPlainText()).encode(unicode(stream.codec().name()))
LookupError: unknown encoding: System

Original comment by andresgattinoni on 5 Aug 2010 at 2:57

GoogleCodeExporter commented 9 years ago
same problem fedora goddard

Original comment by amc...@gmail.com on 5 Aug 2010 at 5:30

GoogleCodeExporter commented 9 years ago
I don't know if this is right, but reaplcing line 160 for this worked fine for 
me:

encoded =  unicode(stream.codec().toUnicode(self.toPlainText()))

Original comment by andresgattinoni on 5 Aug 2010 at 5:50

GoogleCodeExporter commented 9 years ago
@15 the problem there is that we are saving the unicode object and we need to 
save an encoded string. I'm checking it out now.

Original comment by roberto.alsina on 6 Aug 2010 at 10:38

GoogleCodeExporter commented 9 years ago
Please try again with r462. If "save as" works well, I can do the rest in 
minutes :-)

Original comment by roberto.alsina on 6 Aug 2010 at 10:43

GoogleCodeExporter commented 9 years ago
The saving works. When I'm still getting errors. The beep exception came back!

python marave-editor
Using canvas editor
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
Disabling spellchecker
FNAME: /home/elbarto/test.txt
FNAME: /home/elbarto/lele.pepe
Traceback (most recent call last):
  File "/home/elbarto/marave-read-only/marave/main.py", line 947, in close
    self.beep.stop()
AttributeError: 'NoneType' object has no attribute 'stop'
Segmentation fault

Original comment by andresgattinoni on 6 Aug 2010 at 10:54

GoogleCodeExporter commented 9 years ago
Updated to r462, now I get no segfault and "saving as" works ok. :-)

marcelo@marcelo-laptop:~/src/marave-read-only$ svn up
U    marave/editor/spelltextedit.py
Actualizado a la revisión 462.
marcelo@marcelo-laptop:~/src/marave-read-only$ ./marave-editor 
Using canvas editor
<module 'marave' from '/home/marcelo/src/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/marcelo/src/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/marcelo/src/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/marcelo/src/marave-read-only/marave/__init__.pyc'>
Disabling spellchecker
FNAME: /home/marcelo/test.txt
marcelo@marcelo-laptop:~/src/marave-read-only$ cd
marcelo@marcelo-laptop:~$ cat test.txt 
asdfasdfasdfasdf

adsf
asd
fasdf

Regards

Original comment by fernandezm on 6 Aug 2010 at 10:56

GoogleCodeExporter commented 9 years ago
@18: but that exception is in another line now :-) Fixed in r463

@19: great!

Since "save as" works for both of you, I'll do the same for the other file 
dialogs.

Original comment by roberto.alsina on 6 Aug 2010 at 11:07

GoogleCodeExporter commented 9 years ago
Ok, now all file dialogs are fixed in r465. How about color dialogs? If you 
open the fonts row in the menu and click on the color wheel, is it broken too?

Original comment by roberto.alsina on 6 Aug 2010 at 11:17

GoogleCodeExporter commented 9 years ago
All dialogs are working great for me now. 
The segfault when I quit persists, though.

Original comment by andresgattinoni on 6 Aug 2010 at 11:19

GoogleCodeExporter commented 9 years ago
+1 to andresgattinoni, dialogs fine and the segfault appeared again. :-/

Original comment by fernandezm on 6 Aug 2010 at 11:24

GoogleCodeExporter commented 9 years ago
Are the segfaults there in r465?

Original comment by roberto.alsina on 6 Aug 2010 at 11:38

GoogleCodeExporter commented 9 years ago
Yep.

Original comment by andresgattinoni on 6 Aug 2010 at 11:39

GoogleCodeExporter commented 9 years ago
Honestly... if it saves, closes then crashes it's not terrible :-)

Another Ubuntu problem: does the settings button work?

Original comment by roberto.alsina on 7 Aug 2010 at 12:31

GoogleCodeExporter commented 9 years ago
Yep, the settings button is working fine for me.
I had this exception on the stdout but I didn't notice anything wrong in the UI.

elbarto@tarantino:~/marave-read-only$ python marave-editor
Using canvas editor
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
<module 'marave' from '/home/elbarto/marave-read-only/marave/__init__.pyc'>
Disabling spellchecker
Traceback (most recent call last):
  File "/home/elbarto/marave-read-only/marave/plugins/plugins.py", line 53, in enable
    client.pluginButton.show()
AttributeError: 'MainWidget' object has no attribute 'pluginButton'
Traceback (most recent call last):
  File "/home/elbarto/marave-read-only/marave/plugins/plugins.py", line 55, in enable
    client.pluginButton.hide()
AttributeError: 'MainWidget' object has no attribute 'pluginButton'
Segmentation fault

Original comment by andresgattinoni on 7 Aug 2010 at 3:56

GoogleCodeExporter commented 9 years ago
same problem here with ubuntu 11.04. can not save :( apart from that the 
program looks great

Original comment by nilsjan...@gmail.com on 29 May 2011 at 1:32

GoogleCodeExporter commented 9 years ago
did U tried to run editor with sudo privileges? saving and loading works fine 
this way.

Original comment by P.Lukasi...@gmail.com on 1 Jun 2011 at 8:13