nekohayo / specto

Automatically exported from code.google.com/p/specto
0 stars 0 forks source link

startup quit warning dialog crashes if you click cancel #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Specto cannot quit while it's checking watches, because that actually
happens before gtk is called, or something like that. So, the temporary
band-aid solution is to show a dialog informing the user that specto has
not finished checking watches, and to wait a little. This is ugly and
should be fixed, but at least, for the moment being, the user actually
knows why he can't quit specto.

Band-aid solution applied: display a warning dialog that explains to the
user that he must wait.

What needs to be done next is either:
- really fix the problem or,
- create a real dialog that allows doing killall specto in case of problems.

Problem mostly fixed (but not entirely). Specto now stops the refresh
process when you try quitting, and will still display that primitive zenity
information dialog.

Ideally, we need to find a way to quit "when the last watch has finished
updating".

Original issue reported on code.google.com by nekoh...@gmail.com on 12 Nov 2006 at 9:48

GoogleCodeExporter commented 9 years ago
Near the end of main.py, there is something like this:

try:
    gtk.main_quit()
except:
    self.notifier.stop_refresh = True
    os.system("zenity --info --title='Cannot quit' --text='blah blah'")

What we need to do is replace the zenity dialog with a real gtk one, which says 
this:

Specto is currently busy and cannot quit yet. This may be because it is 
checking for
watch updates. However, you can try forcing it to quit by clicking the murder 
button.
[Murder] [Cancel]

Clicking murder would do something like this:
try:
   sys.exit(0)
except:
  kill the specto process with killall

Original comment by nekoh...@gmail.com on 12 Nov 2006 at 9:50

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 15 Nov 2006 at 12:07

GoogleCodeExporter commented 9 years ago

Original comment by woutclym...@gmail.com on 21 Nov 2006 at 10:28

GoogleCodeExporter commented 9 years ago
I created a dialog that asks if specto has to be killed. this is not the best
solution but it works for now.

Original comment by woutclym...@gmail.com on 12 Dec 2006 at 6:27

GoogleCodeExporter commented 9 years ago
Could the new support for threading solve the problem? The code looks like this 
in
main.py:

    def quit(self, *args):
        """ Save the save and position from the notifier and quit Specto. """
        if self.notifier.get_state()==True and not self.notifier_keep_hidden:
            self.notifier.save_size_and_position()#when quitting specto abruptly,
remember the notifier window properties
        try:
            gtk.main_quit()
        except:
            self.notifier.stop_refresh = True
            #create a close dialog
            dialog = gtk.Dialog("Error quitting specto", None, gtk.DIALOG_MODAL |
gtk.DIALOG_DESTROY_WITH_PARENT, None)
            dialog.add_button(gtk.STOCK_CANCEL, -1)
            dialog.add_button(_("Murder!"), 3)            
            label = gtk.Label(_('Specto is currently busy and cannot quit
yet.\n\nThis may be because it is checking for watch updates.\nHowever, you can 
try
forcing it to quit by clicking the murder button.'))
            dialog.vbox.pack_start(label, True, True, 20)
            label.show()
            icon = gtk.gdk.pixbuf_new_from_file(self.PATH +
'icons/specto_window_icon.png' )
            dialog.set_icon(icon)
            answer = dialog.run()
            if answer == 3:
                try:
                    sys.exit(0)
                except:
                    #kill the specto process with killall
                    os.system('killall specto')
            else:
                dialog.destroy()

What if we do something like this:
if self.notifier.get_state()==True and not self.notifier_keep_hidden:
    self.notifier.save_size_and_position()
try:
    gtk.main_quit()
except:
    hid the notifier window
    self.notifier.stop_refresh = True
        >>>>>> and stop_refresh should now use a thread.join() ??
    try: gtk.main_quit()
    except: killall specto

Could it work properly?

Original comment by nekoh...@gmail.com on 16 Dec 2006 at 5:30

GoogleCodeExporter commented 9 years ago
issue #29 has been fixed and will be committed shortly. Since the dialog is
informative enough and works, I assume this problem is not really relevant 
anymore.

Original comment by nekoh...@gmail.com on 17 Jun 2007 at 5:22

GoogleCodeExporter commented 9 years ago
This is something that has been lying there for a while. If you try quitting 
while
specto is doing the first watch check run, you have a nice dialog asking if you 
want
to "murder!" or "cancel".

The problem is that they both do essentially the same thing, because for some 
reason,
cancel crashes specto:

Unhandled exception in thread started by <bound method Watch_web_static.update 
of
<spectlib/plugins/watch_web_static.Watch_web_static instance at 0x862c18c>>

Original comment by nekoh...@gmail.com on 18 Mar 2008 at 1:34

GoogleCodeExporter commented 9 years ago
also see issue 29 ? It seems I had already reported and fixed this a long time 
ago
but it resurfaced?

Original comment by nekoh...@gmail.com on 18 Mar 2008 at 2:00

GoogleCodeExporter commented 9 years ago
I dont think the web watch crashed because you clicked cancel, i also tried it 
and i
could not reproduce it (the error is also different).

Original comment by woutclym...@gmail.com on 19 Mar 2008 at 9:59

GoogleCodeExporter commented 9 years ago
well, this issue does exist and has been reproducable on my side for a long 
time, on
various configurations. See the attached video. This morning I indeed had a 
different
error:

Traceback (most recent call last):
  File "./specto", line 30, in <module>
    specto = Specto()
  File "/home/jeff/trunks/specto-woutc/spectlib/main.py", line 127, in __init__
    self.notifier.refresh_all_watches()
  File "/home/jeff/trunks/specto-woutc/spectlib/notifier.py", line 194, in
refresh_all_watches
    self.specto.watch_db[id].start()
  File "/home/jeff/trunks/specto-woutc/spectlib/watch.py", line 78, in start
    self.start_update()
  File "/home/jeff/trunks/specto-woutc/spectlib/watch.py", line 107, in start_update
    self.specto.mark_watch_status("updating", self.id)
  File "/home/jeff/trunks/specto-woutc/spectlib/main.py", line 201, in mark_watch_status
    self.notifier.mark_watch_status(status, id)
  File "/home/jeff/trunks/specto-woutc/spectlib/notifier.py", line 225, in
mark_watch_status
    statusbar.push(0, _(datetime.today().strftime("%H:%M") + ": The watch \"" +
watch.name + "\" started updating."))            
AttributeError: 'NoneType' object has no attribute 'push'

But that was pure luck, because when I deactivated composite metacity to shoot 
the
video, I could not get this error again. Instead, I got the usual 

Unhandled exception in thread started by <bound method Watch_web_static.update 
of
<spectlib/plugins/watch_web_static.Watch_web_static instance at 0x85e6c0c>>

Original comment by nekoh...@gmail.com on 21 Mar 2008 at 1:24

Attachments:

GoogleCodeExporter commented 9 years ago
Nekohayo, please try this again, with the new super traceback you should be 
able to
get some error message.

Original comment by woutclym...@gmail.com on 22 Apr 2008 at 12:11

GoogleCodeExporter commented 9 years ago
in the terminal:

jeff@khloe:~/trunks/specto-woutc$ ./launch.sh 

(when cancelling and the ui crashed)

ERROR - psy-chose - There was an error marking the watch status
ERROR - psy-chose - There was an error marking the watch status
ERROR - université - There was an error marking the watch status
INFO - université - Watch is updated!
ERROR - université - There was an error marking the watch status
ERROR - nekohayo - There was an error marking the watch status
ERROR - nekohayo - There was an error marking the watch status
ERROR - nekohayo - There was an error marking the watch status
ERROR - madman2k - There was an error marking the watch status
ERROR - madman2k - There was an error marking the watch status
ERROR - OpenOffice performance - There was an error marking the watch status
ERROR - OpenOffice performance - There was an error marking the watch status
ERROR - wordpress svn tags - There was an error marking the watch status
ERROR - wordpress svn tags - There was an error marking the watch status
ERROR - DJ TV - There was an error marking the watch status
ERROR - DJ TV - There was an error marking the watch status
Traceback (most recent call last):
  File "./specto", line 30, in <module>
    specto = Specto()
  File "/home/jeff/trunks/specto-woutc/spectlib/main.py", line 127, in __init__
    self.notifier.refresh_all_watches()
  File "/home/jeff/trunks/specto-woutc/spectlib/notifier.py", line 196, in
refresh_all_watches
    self.wTree.get_widget("button_refresh").set_stock_id("gtk-refresh") #menu item,
does not allow changing label
AttributeError: 'NoneType' object has no attribute 'set_stock_id'

Error log attached. Not much useful?

Original comment by nekoh...@gmail.com on 22 Apr 2008 at 2:59

Attachments:

GoogleCodeExporter commented 9 years ago
At least now i know where the error happens, so it is definitely useful!
But it is much strange that it can not find any widgets when you click 
cancel....

Original comment by woutclym...@gmail.com on 23 Apr 2008 at 5:45

GoogleCodeExporter commented 9 years ago
I investigated this problem and i think it never worked.
The problem is that we do a gtk.main_quit()...this function is pending because 
a 
watch is updating. so when the watch finished updating, the gtk.main_quit() 
function 
is executed and it kills the notifier (that's why it can not find any object 
anymore: 'NoneType' object has no attribute 'set_stock_id').

So we have to find a different approach to show the dialog and make the cancel 
work.

Or another way would be to show a dialog without buttons (or only murder) that 
says 
something like "Specto is closing, please wait...."

Original comment by woutclym...@gmail.com on 10 Oct 2008 at 6:02

GoogleCodeExporter commented 9 years ago
Your hypothesis makes sense. Maybe what we could do is
- remove the cancel button, since there is no logical way that I can see (so 
far) to
make this work
- put this dialog in its own thread so that it does not block gtk.main_quit()
- clicking Murder kills the specto process
- if, because of some magic, specto finishes the watch check, gtk.main_quit 
happens
and we should destroy this "please wait, I'm dying" dialog (unless it's already
killed by gtk.main_quit?)

Original comment by nekoh...@gmail.com on 10 Oct 2008 at 1:40

GoogleCodeExporter commented 9 years ago
I would show only the "murder" button and have a message that say's: specto is 
still 
busy checking a watch, you can "murder" it if you want to close it now.

Since we have a timeout on webwatches now, waiting until the timeout is 
finished will 
close specto so no need to have a cancel button. if the user is really 
unpatient, he 
could still "murder" specto :)

So remove the "cancel" button and give me a good text to display in the dialog

Original comment by woutclym...@gmail.com on 16 Oct 2008 at 12:10

GoogleCodeExporter commented 9 years ago
Some example code that might help us creating a proper dialog:

d = gtk.Dialog(title=title, parent = self.progwin,
                       flags=gtk.DIALOG_MODAL,
                       buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
                                gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))

ret = d.run()
d.destroy()
gtk_main()
if ret != gtk.RESPONSE_ACCEPT:
   return 1

Original comment by woutclym...@gmail.com on 24 Oct 2008 at 6:41

GoogleCodeExporter commented 9 years ago
"Specto will exit when the current watch has finished checking for updates. If 
you
want to stop it immediately, use the Murder button below."

Depends on issue #122.

Original comment by nekoh...@gmail.com on 31 Mar 2009 at 4:56

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 31 Mar 2009 at 5:00

GoogleCodeExporter commented 9 years ago
Fixed in rev 163

Original comment by woutclym...@gmail.com on 2 Apr 2009 at 5:26

GoogleCodeExporter commented 9 years ago

Original comment by nekoh...@gmail.com on 2 Apr 2009 at 6:19