How to create a non-interactive message-to-user in a window ?

Hi,

Maybe one of you has an idea for the following ?

My script needs to ungzip a tar archive.
I want to give user feedback that this operation is being performed, without requiring user interaction (so, modal dialogs are out).

The best I could manage was using the following:

def un_tgz(app,tgz_save_states_paths):
“”"
“”"
for path in tgz_save_states_paths:
cwd = os.path.dirname(path)
# Temporarily change directory to the directory of the tgz file
# (save $cwd in cwd) so the untarring will be done in the
# same directory where the tgz file resides.
if (path.rfind(".tgz") != -1):
tgz_dir = os.path.dirname(path)
tgz_name = os.path.basename(path)
(tgz_name_without_extension, extension) = os.path.splitext(tgz_name)
save_state_name = os.path.join(tgz_dir,tgz_name_without_extension)

        # If save_state sub-dir already exists in same directory as tgz_dir,
        # do not unzip tgz_name, but give approperiate message.
        if glob.glob(save_state_name):
            msg = "Directory %s already exists in %s. %s will not be untarred!" % (tgz_name_without_extension,
                    tgz_dir, tgz_name)
            info_message_without_interaction(msg)
            print line()+". "+msg
        else:
            msg = "Untarring %s  into  %s." % (tgz_name,tgz_dir)
            info_message_without_interaction(msg)
            print line()+". "+msg
            os.chdir(tgz_dir)
            tar = tarfile.open(path)
            tar.extractall()
            tar.close()
            os.chdir(cwd)

def info_message_without_interaction(msg):
“”"
“”"
average_char_width = 7
frame = wx.Frame(parent=None, title=msg, size=(average_char_width * len(msg),0))
panel = wx.Panel(frame)
sizer = wx.BoxSizer(wx.VERTICAL)
frame.Show()

Which put on the screen a frame with only a title, while the untarring is performed.

However, I did not manage to make the frame include a widget that could display text (e.g., StaticText), so the message to the user will be not just in the frame heading.

Any ideas ?

Thanks,
Ron.

auxiliary_functions.py (6.78 KB)

Personally, I prefer my users have Snarl installed if they’re on Windows, or Growl if on mac – I have no linux folk at the moment so don’t know about the equivalents. But in the case that one doesn’t have either of those, I fall back to Andrea Gavana’s ToasterBox (http://xoomer.alice.it/infinity77/main/ToasterBox.html), doing basically the below for what its worth. The Growl and snarl libraries I got off the respective notifiers websites.

def send(message, title=None):
import subprocess
messageShown = False
if sys.platform == “win32”:
try:
import snarl
snarl.snShowMessage(title and str(title) or “My Application”, str(message), timeout=5)
messageShown = True
except:
logging.exception("(Non-Fatal Error) Snarl not present to send notification to.")
else:
try:
import Growl
gn = Growl.GrowlNotifier(applicationName=“My Application”, notifications=[“Falcon Message”], defaultNotifications=[“My Application’s Message”])
gn.notify(“My Application’s Message”, title and title or “My Applicationl”, message)
messageShown = True
except:
logging.exception("(Non-Fatal Error) Growl not present to send notification to.")

if not messageShown:
    import ToasterBox as TB
    import wx
    app = wx.GetApp()
    if app:
        top = app.GetTopWindow()
        if top:
            tb = TB.ToasterBox(wx.GetApp().GetTopWindow(), TB.TB_SIMPLE, 0, TB.TB_ONCLICK)
            tb.SetPopupSize((210,130))
            tb.SetPopupPauseTime(4000)
            tb.SetPopupScrollSpeed(1)
            tb.SetPopupText(message)

            ScreenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
            ScreenDepth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)               
           
            left = ScreenWidth - 210
            top = ScreenDepth - 130

            tb.SetPopupTextFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False))
           
            tb.SetPopupPosition((left, top))
            tb.Play()

Hi Mr. Hansen,

Thanks for the tip on ToasterBox. It is an excellent widget, and is well suited to my needs.

BTW, I’m unable to set the foreground colour (using SetPopupTextColor) to anything but the default wx.BLACK.
This happens both in ToasterBoxDemo.py and in my own application.
Is that a known bug (didn’t really find one while Googling) or is that my environment ?

Bye,

Ron.

P.S.: I’m running on Windows XP. Python 2.5.2. wx-2.8-msw-unicode.

···

From: Stephen Hansen [mailto:apt.shansen@gmail.com]
Sent: Sunday, February 01, 2009 16:26
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] How to create a non-interactive message-to-user in a window ?

Personally, I prefer my users have Snarl installed if they’re on Windows, or Growl if on mac – I have no linux folk at the moment so don’t know about the equivalents. But in the case that one doesn’t have either of those, I fall back to Andrea Gavana’s ToasterBox (http://xoomer.alice.it/infinity77/main/ToasterBox.html), doing basically the below for what its worth. The Growl and snarl libraries I got off the respective notifiers websites.

def send(message, title=None):
import subprocess
messageShown = False
if sys.platform == “win32”:
try:
import snarl
snarl.snShowMessage(title and str(title) or “My Application”, str(message), timeout=5)
messageShown = True
except:
logging.exception(“(Non-Fatal Error) Snarl not present to send notification to.”)
else:
try:
import Growl
gn = Growl.GrowlNotifier(applicationName=“My Application”, notifications=[“Falcon Message”], defaultNotifications=[“My Application’s Message”])
gn.notify(“My Application’s Message”, title and title or “My Applicationl”, message)
messageShown = True
except:
logging.exception(“(Non-Fatal Error) Growl not present to send notification to.”)

  if not messageShown:
      import ToasterBox as TB
      import wx
      app = wx.GetApp()
      if app:
          top = app.GetTopWindow()
          if top:
              tb = TB.ToasterBox(wx.GetApp().GetTopWindow(), TB.TB_SIMPLE, 0, TB.TB_ONCLICK)
              tb.SetPopupSize((210,130))
              tb.SetPopupPauseTime(4000)
              tb.SetPopupScrollSpeed(1)
              tb.SetPopupText(message)

              ScreenWidth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_X)
              ScreenDepth = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)               
             
              left = ScreenWidth - 210
              top = ScreenDepth - 130

              tb.SetPopupTextFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False))
             
              tb.SetPopupPosition((left, top))
              tb.Play()

Barak, Ron wrote:

Hi Mr. Hansen,

Thanks for the tip on ToasterBox. It is an excellent
widget, and is well suited to my needs.

BTW, I’m unable to set the
foreground colour (using SetPopupTextColor) to anything but the default
wx.BLACK.

This happens both in ToasterBoxDemo.py and in my own application.

Is that a known bug (didn’t really find one
while Googling) or is that my environment ?

Bye,

Ron.

P.S.: I’m running on
Windows XP. Python 2.5.2. wx-2.8-msw-unicode.

[snip]

In
on Jan 14th 2009, Andrea committed to SVN my fix for this bug and it
now works for me (with /simple/ TB’s). :slight_smile:
Did you sync from SVN before that date?
-R

···

http://lists.wxwidgets.org/pipermail/wxpython-users/2009-January/083353.html

Stephen Hansen wrote:

Personally, I prefer my users have Snarl installed if they're on
Windows, or Growl if on mac -- I have no linux folk at the moment so
don't know about the equivalents. But in the case that one doesn't
have either of those, I fall back to Andrea Gavana's ToasterBox
(http://xoomer.alice.it/infinity77/main/ToasterBox.html), doing
basically the below for what its worth. The Growl and snarl libraries
I got off the respective notifiers websites.

[snip]

So what are the install-time pre-requisites for Snarl / Growl?

The thing I like about TB is that it's implemented wholly in *my*
application.

I like the /idea/ of a central notification manager, but I don't like
having to make my user install something extra.

I already have to ask them to install Python, wxPython and Pyro.

-R

Hi R,

I downloaded the ToasterBox zip from http://xoomer.alice.it/infinity77/main/GUI2Exe.html.

If I want to update my 2.5.2 Python with an updated ToasterBox, where should I point my SVN client ?

Looking at http://www.wxpython.org/download.php, I don’t see references to my Python version (I never used SVN, so I may know the correct questions to ask).

Bye,

Ron.

···

From: Ranec [mailto:wxpython@cemery.org.uk]
Sent: Monday, February 02, 2009 13:01
To:
wxpython-users@lists.wxwidgets.org
Subject: [wxpython-users] Re: ToasterBox’s SetPopupTextColor dosen’t work ?

Barak, Ron wrote:

Hi Mr. Hansen,
Thanks for the tip on ToasterBox. It is an excellent widget, and is well suited to my needs.
BTW, I'm unable to set the foreground colour (using SetPopupTextColor) to anything but the default wx.BLACK.
This happens both in ToasterBoxDemo.py and in my own application.
Is that a known bug (didn't really find one while Googling) or is that my environment ?

Bye,

Ron.

P .S.: I’m running on Windows XP. Python 2.5.2. wx-2.8-msw-unicode.

[snip]

In http://lists.wxwidgets.org/pipermail/wxpython-users/2009-January/083353.html
on Jan 14th 2009, Andrea committed to SVN my fix for this bug and it now works for me (with /simple/ TB’s). :slight_smile:

Did you sync from SVN before that date?

-R

Barak, Ron wrote:

Hi R,
I downloaded the ToasterBox zip from
http://xoomer.alice.it/infinity77/main/GUI2Exe.html.
If I want to update my 2.5.2 Python with an updated ToasterBox, where
should I point my SVN client ?
Looking at Redirecting..., I don't see
references to my Python version (I never used SVN, so I may know the
correct questions to ask).
Bye,
Ron.

[snip]

Andrea uses the wxPython SVN repository. :wink:

I use the cygwin command-line SVN client, so to get AGW (which contains
ToasterBox), I just do

svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW

Let's say that you end up with c:\src\AGW checked out.
Then I just put c:\src\AGW on my PYTHONPATH and when I import
agw.toasterbox I get the one from SVN.
When AGW starts shipping with wxPython (probably at version 2.9 (being a
dev. release)), it'll probably just come for free with wxPython (likely
as wx.agw.toasterbox or something like that).

I just looked and it does indeed look like my patch is in SVN.

Enjoy,

-R

Hi R,

It seems I have problems just connecting to the SVN (as I said, I never used SVN before).
I’m trying to connect from a cygwin and I get:

$ svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW
svn: OPTIONS of ‘http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW’: could not connect to server (http://svn.wxwidgets.org)

I couldn’t find a verbose option on SVN, so all I could think of was to strace the command (below), but that didn’t help much either, it terms of clues.

Trying to follow http://ist.berkeley.edu/as-ag/tools/howto/cygwin.html, and http://instantbadger.blogspot.com/2006/09/svn-over-ssh-svnssh-on-windows-via.html didn’t help much either:

$ svn co svn+ssh://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW
The authenticity of host ‘svn.wxwidgets.org (72.9.158.153)’ can’t be established.
RSA key fingerprint is d7:2c:58:a7:a8:96:5b:fc:fa:24:bc:52:c4:39:c6:3b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘svn.wxwidgets.org,72.9.158.153’ (RSA) to the list of known hosts.
Permission denied (publickey).
svn: Connection closed unexpectedly

Could you guess what is wrong ?

Bye,
Ron.

$ strace -f svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW

25 396488 [main] svn 3052 fhandler_base::open: C000003A = NtCreateFile (0x0, 80100000, C:\cygwin\etc\subversion\config, io, NULL, 0, 7, 1, 4020, NULL, 0)
26 396514 [main] svn 3052 fhandler_base::open: 0 = fhandler_base::open (C:\cygwin\etc\subversion\config, 0x110000)
26 396540 [main] svn 3052 fhandler_base::open_fs: 0 = fhandler_disk_file::open
(C:\cygwin\etc\subversion\config, 0x10000)
26 396566 [main] svn 3052 open: -1 = open (/etc/subversion/config, 0x10000)
156 396722 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
31 396753 [main] svn 3052 sig_send: wakeup 0x674
30 396783 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
30 396813 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
33 396846 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
26 396872 [main] svn 3052 open: open (/cygdrive/c/Documents and Settings/rbarak/.subversion/config, 0x10000)
26 396898 [main] svn 3052 normalize_posix_path: src /cygdrive/c/Documents and Settings/rbarak/.subversion/config
25 396923 [main] svn 3052 normalize_posix_path: /cygdrive/c/Documents and Settings/rbarak/.subversion/config = normalize_posix_path (/cygdrive/c/Documents and Settings/rbarak/.subversion/config)
26 396949 [main] svn 3052 mount_info::conv_to_win32_path: conv_to_win32_path (/cygdrive/c/Documents and Settings/rbarak/.subversion/config)
38 396987 [main] svn 3052 mount_info::cygdrive_win32_path: src ‘/cygdrive/c/Documents and Settings/rbarak/.subversion/config’, dst ‘c:\Documents and Settings\rbarak.subversion\config’
4161 401148 [main] svn 3052 set_flags: flags: binary (0x2)
144 401292 [main] svn 3052 mount_info::conv_to_win32_path: src_path /cygdrive/c/Documents and Settings/rbarak/.subversion/config, dst c:\Documents and Settings\rbarak.subversion\config, flags 0x2A, rc 0
97 401389 [main] svn 3052 symlink_info::check: not a symlink
25 401414 [main] svn 3052 symlink_info::check: 0 = symlink.check (c:\Documents and Settings\rbarak.subversion\config, 0x22C0D0) (0x2A)
28 401442 [main] svn 3052 path_conv::check: this->path(c:\Documents and Settings\rbarak.subversion\config), has_acls(1)
27 401469 [main] svn 3052 build_fh_pc: fh 0x61169E90
28 401497 [main] svn 3052 fhandler_base::open: (c:\Documents and Settings\rbarak.subversion\config, 0x110000)
130 401627 [main] svn 3052 fhandler_base::set_flags: flags 0x110000, supplied_bin 0x10000
26 401653 [main] svn 3052 fhandler_base::set_flags: O_TEXT/O_BINARY set in flags 0x10000
23 401676 [main] svn 3052 fhandler_base::set_flags: filemode set to binary
21 401697 [main] svn 3052 fhandler_base::open: 0 = NtCreateFile (0x674, 80100000, c:\Documents and Settings\rbarak.subversion\config, io, NULL, 0, 7, 1, 4020, NULL, 0)
25 401722 [main] svn 3052 fhandler_base::open: 1 = fhandler_base::open (c:\Documents and Settings\rbarak.subversion\config, 0x110000)
22 401744 [main] svn 3052 fhandler_base::open_fs: 1 = fhandler_disk_file::open (c:\Documents and Settings\rbarak.subversion\config, 0x10000)
24 401768 [main] svn 3052 open: 3 = open (/cygdrive/c/Documents and Settings/rbarak/.subversion/config, 0x10000)
94 401862 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
27 401889 [main] svn 3052 sig_send: wakeup 0x670
28 401917 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x670
408 402325 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x670
43 402368 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
25 402393 [main] svn 3052 readv: readv (3, 0x22C7C0, 1) blocking, sigcatchers 0
23 402416 [main] svn 3052 readv: no need to call ready_for_read
92 402508 [main] svn 3052 fhandler_base::read: returning 5680, binary mode
31 402539 [main] svn 3052 readv: 5680 = readv (3, 0x22C7C0, 1), errno 2
28 402567 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
28 402595 [main] svn 3052 sig_send: wakeup 0x670
29 402624 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x670
26 402650 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x670
30 402680 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
25 402705 [main] svn 3052 readv: readv (3, 0x22C7C0, 1) blocking, sigcatchers 0
25 402730 [main] svn 3052 readv: no need to call ready_for_read
27 402757 [main] svn 3052 fhandler_base::read: returning 0, binary mode
25 402782 [main] svn 3052 readv: 0 = readv (3, 0x22C7C0, 1), errno 2
1016 403798 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
4965 408763 [main] svn 3052 sig_send: wakeup 0x670
51 408814 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x670
30 408844 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x670
204 409048 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
35 409083 [main] svn 3052 readv: readv (3, 0x22C7C0, 1) blocking, sigcatchers 0
26 409109 [main] svn 3052 readv: no need to call ready_for_read
35 409144 [main] svn 3052 fhandler_base::read: returning 0, binary mode
25 409169 [main] svn 3052 readv: 0 = readv (3, 0x22C7C0, 1), errno 2
155 409324 [main] svn 3052 close: close (3)
26 409350 [main] svn 3052 fhandler_base::close: closing ‘/cygdrive/c/Documents and Settings/rbarak/.subversion/config’ handle 0x674
71 409421 [main] svn 3052 close: 0 = close (3)
32 409453 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
28 409481 [main] svn 3052 sig_send: wakeup 0x674
28 409509 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
27 409536 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 409566 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
26 409592 [main] svn 3052 sigaction_worker: signal 2, newact 0x22CA20 (handler 0x4077C0), oa 0x0
26 409618 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
27 409645 [main] svn 3052 sig_send: wakeup 0x674
27 409672 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 409698 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
29 409727 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
24 409751 [main] svn 3052 sigaction_worker: signal 1, newact 0x22CA20 (handler 0x4077C0), oa 0x0
195 409946 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
28 409974 [main] svn 3052 sig_send: wakeup 0x674
27 410001 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
27 410028 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 410058 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
24 410082 [main] svn 3052 sigaction_worker: signal 15, newact 0x22CA20 (handler 0x4077C0), oa 0x0
26 410108 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
26 410134 [main] svn 3052 sig_send: wakeup 0x674
27 410161 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 410187 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 410217 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
24 410241 [main] svn 3052 sigaction_worker: signal 13, newact 0x22CA20 (handler 0x1), oa 0x0
25 410266 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -13, its_me 1
26 410292 [main] svn 3052 sig_send: wakeup 0x674
28 410320 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 410346 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 410376 [main] svn 3052 sig_send: returning 0x0 from sending signal -13
26 410402 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
26 410428 [main] svn 3052 sig_send: wakeup 0x674
28 410456 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 410482 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 410512 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
25 410537 [main] svn 3052 sigaction_worker: signal 25, newact 0x22CA20 (handler 0x1), oa 0x0
25 410562 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -25, its_me 1
27 410589 [main] svn 3052 sig_send: wakeup 0x674
28 410617 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 410643 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
29 410672 [main] svn 3052 sig_send: returning 0x0 from sending signal -25
206 410878 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
30 410908 [main] svn 3052 sig_send: wakeup 0x674
29 410937 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
26 410963 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
30 410993 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
25 411018 [main] svn 3052 void: 0x1 = signal (13, 0x1)
84626 495644 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
112 495756 [main] svn 3052 sig_send: wakeup 0x674
70 495826 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x674
37 495863 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x674
46 495909 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
4408 500317 [main] svn 3052 wsock_init: res 0
687 501004 [main] svn 3052 wsock_init: wVersion 514
144 501148 [main] svn 3052 wsock_init: wHighVersion 514
33 501181 [main] svn 3052 wsock_init: szDescription WinSock 2.0
29 501210 [main] svn 3052 wsock_init: szSystemStatus Running
39 501249 [main] svn 3052 wsock_init: iMaxSockets 0
24 501273 [main] svn 3052 wsock_init: iMaxUdpDg 0
23 501296 [main] svn 3052 wsock_init: lpVendorInfo 0
12401 513697 [main] svn 3052 __dup_ent: duping hostent “svn.wxwidgets.org”, 0xC584F8
84 513781 [main] svn 3052 __dup_ent: duped hostent “svn.wxwidgets.org”, 0x10047CC8
31 513812 [main] svn 3052 cygwin_gethostbyname: h_name svn.wxwidgets.org
210 514022 [main] svn 3052 cygwin_socket: socket (2, 1, 0)
2568 516590 [main] svn 3052 fdsock: reset socket inheritance
796 517386 [main] svn 3052 build_fh_pc: fh 0x61169E90
108 517494 [main] svn 3052 fhandler_base::set_flags: flags 0x10002, supplied_bin 0x0
26 517520 [main] svn 3052 fhandler_base::set_flags: O_TEXT/O_BINARY set in flags 0x10000
22 517542 [main] svn 3052 fhandler_base::set_flags: filemode set to binary
22 517564 [main] svn 3052 fdsock: fd 3, name ‘’, soc 0x634
21 517585 [main] svn 3052 cygwin_socket: 3 = socket (2, 1, 0)
30 517615 [main] svn 3052 fcntl_worker: 0 = fcntl (3, 1, 0x0)
23 517638 [main] svn 3052 fhandler_socket::set_close_on_exec: set close_on_exec for to 1
26 517664 [main] svn 3052 fcntl_worker: 0 = fcntl (3, 2, 0x1)
44 517708 [main] svn 3052 cygwin_setsockopt: setsockopt optval=1
24 517732 [main] svn 3052 cygwin_setsockopt: 0 = setsockopt (3, 6, 1, 0x22C2B8, 4)
26 517758 [main] svn 3052 fhandler_base::fcntl: GETFL: 0x10002
1849 519607 [main] svn 3052 fcntl_worker: 65538 = fcntl (3, 3, 0x1)
205 519812 [main] svn 3052 fhandler_socket::ioctl: socket is now nonblocking
27 519839 [main] svn 3052 fhandler_socket::ioctl: 0 = ioctl_socket (8004667E, 22C1F8)
23 519862 [main] svn 3052 fhandler_base::set_flags: flags 0x14002, supplied_bin 0x0
22 519884 [main] svn 3052 fhandler_base::set_flags: O_TEXT/O_BINARY set in flags 0x10000
22 519906 [main] svn 3052 fhandler_base::set_flags: filemode set to binary
21 519927 [main] svn 3052 fcntl_worker: 0 = fcntl (3, 4, 0x14002)
23 519950 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
26 519976 [main] svn 3052 sig_send: wakeup 0x62C
29 520005 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x62C
29 520034 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x62C
32 520066 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
8344 528410 [main] svn 3052 __set_errno: void __set_winsock_errno(const char*, int):234 val 119
2958 531368 [main] svn 3052 __set_winsock_errno: connect:788 - winsock error 10036 → errno 119
657 532025 [main] svn 3052 cygwin_connect: -1 = connect (3, 0x22C2C0, 16)
226 532251 [main] svn 3052 cygwin_select: 4, 0x22C1D0, 0x22C1B0, 0x22C190, 0x22C230
351 532602 [main] svn 3052 dtable::select_write: fd 3
25 532627 [main] svn 3052 dtable::select_except: fd 3
24 532651 [main] svn 3052 cygwin_select: to->tv_sec 3600, to->tv_usec 0, ms 3600000
25 532676 [main] svn 3052 cygwin_select: sel.always_ready 0
59 532735 [main] svn 3052 start_thread_socket: Handle 0x634
24 532759 [main] svn 3052 start_thread_socket: Added to writefds
23 532782 [main] svn 3052 start_thread_socket: Added to exceptfds
425 533207 [main] svn 3052 start_thread_socket: opened new socket 0x618
95 533302 [main] svn 3052 start_thread_socket: exitsock 0x618
27 533329 [main] svn 3052 start_thread_socket: stuff_start 0x22C114
436 533765 [select_socket] svn 3052 cygthread::stub: thread ‘select_socket’, id 0x14D0, stack_ptr 0x10DCDC0
295 534060 [select_socket] svn 3052 thread_socket: stuff_start 0x1004BF14
3081 537141 [main] svn 3052 select_stuff::wait: m 2, ms 3600000
20938510 21475651 [select_socket] svn 3052 thread_socket: Win32 select returned 1
68 21475719 [select_socket] svn 3052 thread_socket: s 0x10048ED0, testing fd 3 ()
32 21475751 [select_socket] svn 3052 thread_socket: except_ready
29 21475780 [main] svn 3052 select_stuff::wait: woke up. wait_ret 1. verifying
26 21475806 [main] svn 3052 select_stuff::wait: gotone 1
23 21475829 [main] svn 3052 select_stuff::wait: returning 0
24 21475853 [main] svn 3052 select_stuff::cleanup: calling cleanup routines
23 21475876 [main] svn 3052 socket_cleanup: si 0x10048F00 si->thread 0x61106F30
80 21475956 [main] svn 3052 socket_cleanup: sent a byte to exitsock 0x618, res 1
73 21476029 [main] svn 3052 socket_cleanup: reading a byte from exitsock 0x618
33 21476062 [main] svn 3052 socket_cleanup: recv returned 1
44 21476106 [main] svn 3052 socket_cleanup: returning
34 21476140 [main] svn 3052 peek_socket: considering handle 0x634
24 21476164 [main] svn 3052 peek_socket: adding write fd_set , fd 3
31 21476195 [main] svn 3052 peek_socket: WINSOCK_SELECT returned 0
25 21476220 [main] svn 3052 set_bits: me 0x10048ED0, testing fd 3 ()
24 21476244 [main] svn 3052 set_bits: ready 1
23 21476267 [main] svn 3052 select_stuff::poll: returning 1
22 21476289 [main] svn 3052 select_stuff::cleanup: calling cleanup routines
23 21476312 [main] svn 3052 select_stuff::~select_stuff: deleting select records
9924 21486236 [main] svn 3052 cygwin_getsockopt: WinSock SO_ERROR = 10060
69 21486305 [main] svn 3052 cygwin_getsockopt: 0 = getsockopt (3, 65535, 0x1007, 0x22C2B0, 0x22C2B4)
51 21486356 [main] svn 3052 fhandler_socket::ioctl: socket is now blocking
26 21486382 [main] svn 3052 fhandler_socket::ioctl: 0 = ioctl_socket (8004667E, 22C1F8)
24 21486406 [main] svn 3052 fhandler_base::set_flags: flags 0x10002, supplied_bin 0x0
23 21486429 [main] svn 3052 fhandler_base::set_flags: O_TEXT/O_BINARY set in flags 0x10000
22 21486451 [main] svn 3052 fhandler_base::set_flags: filemode set to binary
22 21486473 [main] svn 3052 fcntl_worker: 0 = fcntl (3, 4, 0x10002)
24 21486497 [main] svn 3052 close: close (3)
356 21486853 [main] svn 3052 fhandler_socket::close: 0 = fhandler_socket::close()
320 21487173 [main] svn 3052 close: 0 = close (3)
7606 21494779 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -34, its_me 1
80 21494859 [main] svn 3052 sig_send: wakeup 0x634
176 21495035 [main] svn 3052 sig_send: Waiting for pack.wakeup 0x634
36 21495071 [sig] svn 3052 wait_sig: signalling pack.wakeup 0x634
38 21495109 [main] svn 3052 sig_send: returning 0x0 from sending signal -34
53 21495162 [main] svn 3052 fhandler_base::write: binary write
svn: OPTIONS of ‘http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW’: could not connect to server (http://svn.wxwidgets.org)
3808 21498970 [main] svn 3052 close: close (0)
47 21499017 [main] svn 3052 fhandler_base::close: closing ‘/Device/NamedPipe/Win32Pipes.00000190.00000002’ handle 0x6F8
33 21499050 [main] svn 3052 close: 0 = close (0)
190 21499240 [main] svn 3052 close: close (1)
26 21499266 [main] svn 3052 fhandler_base::close: closing ‘/Device/NamedPipe/Win32Pipes.00000190.00000003’ handle 0x7F8
29 21499295 [main] svn 3052 close: 0 = close (1)
209 21499504 [main] svn 3052 close: close (2)
27 21499531 [main] svn 3052 fhandler_base::close: closing ‘/Device/NamedPipe/Win32Pipes.00000190.00000003’ handle 0x6FC
30 21499561 [main] svn 3052 close: 0 = close (2)
3643 21503204 [main] svn 3052 do_exit: do_exit (256), exit_state 0
43 21503247 [main] svn 3052 void: 0x0 = signal (20, 0x1)
28 21503275 [main] svn 3052 void: 0x4077C0 = signal (1, 0x1)
28 21503303 [main] svn 3052 void: 0x4077C0 = signal (2, 0x1)
28 21503331 [main] svn 3052 void: 0x0 = signal (3, 0x1)
67 21503398 [main] svn 3052 sigproc_terminate: entering
28 21503426 [main] svn 3052 sig_send: sendsig 0x6E8, pid 3052, signal -42, its_me 1
46 21503472 [main] svn 3052 sig_send: Not waiting for sigcomplete. its_me 1 signal -42
37 21503509 [main] svn 3052 sig_send: returning 0x0 from sending signal -42
30 21503539 [main] svn 3052 proc_terminate: nprocs 0
26 21503565 [main] svn 3052 proc_terminate: leaving
128 21503693 [sig] svn 3052 wait_sig: saw __SIGEXIT
37 21503730 [sig] svn 3052 wait_sig: signal thread exiting
276 21504006 [main] svn 3052 __to_clock_t: dwHighDateTime 0, dwLowDateTime 625000
33 21504039 [main] svn 3052 __to_clock_t: total 00000000 0000003E
28 21504067 [main] svn 3052 __to_clock_t: dwHighDateTime 0, dwLowDateTime 312500
27 21504094 [main] svn 3052 __to_clock_t: total 00000000 0000001F
603 21504697 [main] svn 3052 pinfo::exit: Calling ExitProcess n 0x100, exitcode 0x1

···

-----Original Message-----
From: Ranec [mailto:wxpython@cemery.org.uk]
Sent: Monday, February 02, 2009 14:08
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Re: ToasterBox’s SetPopupTextColor dosen’t work ?

Barak, Ron wrote:

Hi R,
I downloaded the ToasterBox zip from
http://xoomer.alice.it/infinity77/main/GUI2Exe.html.
If I want to update my 2.5.2 Python with an updated ToasterBox, where
should I point my SVN client ?
Looking at http://www.wxpython.org/download.php, I don’t see
references to my Python version (I never used SVN, so I may know the
correct questions to ask).
Bye,
Ron.
[snip]

Andrea uses the wxPython SVN repository. :wink:

I use the cygwin command-line SVN client, so to get AGW (which contains ToasterBox), I just do

svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW

Let’s say that you end up with c:\src\AGW checked out.
Then I just put c:\src\AGW on my PYTHONPATH and when I import agw.toasterbox I get the one from SVN.
When AGW starts shipping with wxPython (probably at version 2.9 (being a dev. release)), it’ll probably just come for free with wxPython (likely as wx.agw.toasterbox or something like that).

I just looked and it does indeed look like my patch is in SVN.

Enjoy,

-R

It seems I have problems just connecting to the SVN (as I said, I never used
SVN before).
I'm trying to connect from a cygwin and I get:

$ svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW
svn: OPTIONS of 'http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW’:
could not connect to server (http://svn.wxwidgets.org)

I couldn't find a verbose option on SVN, so all I could think of was to
strace the command (below), but that didn't help much either, it terms of
clues.

What version of svn? Is it a cygwin build or a windows build? Maybe try installing a regular windows version and just svn'n from a regular command prompt: the syntax is identical.

Other then that: it works fine for me. Do you have some sort of HTTP proxy that sits on your internet? It could be interfering: svn is using webdav and some proxies and such don't pass those HTTP commands around right, I've heard.

You can't use svn+ssh because that requires you to have an actual ssh account on the host box. The command you entered -is- the right one and there's nothing else you enter to tell svn to do anything else differently, the problem has to be lower level then it.

--S

So what are the install-time pre-requisites for Snarl / Growl?

The thing I like about TB is that it's implemented wholly in *my*
application.

I like the /idea/ of a central notification manager, but I don't like
having to make my user install something extra.

I already have to ask them to install Python, wxPython and Pyro.

Both Snarl and Growl come with simple installers.

That's why I do have ToasterBox as a fallback. Personally, on the mac? TONS of people have Growl. Its really quite common, though not universal. I find it very annoying -- very -- when applications do their own notifications if those notifications aren't /just right/ (and I define /just right/ as "happening to behave exactly as Growl's preferences are currently set to behave" :)) For example, I positively loathe bottom-up notifications. The proliferation of them annoyed me into quitting using an app once :slight_smile: But to each his own, which is exactly why I like supporting Snarl/Growl where its available: if someone has installed it it means I'll be able to talk to them the way that they have determined they like to be talked to.

Snarl isn't as wide-spread on the Windows world, but more and more apps supporting it will help :slight_smile: As Snarl was recently released as a Simplified BSD, I'm probably going to bundle it along as an optional install -- but I'm using an installer and it looks like you're not. I can't ask my users to install Python, so I just give them a single installer with python + wxpython + all kinds of crap

--S

Barak, Ron wrote:

Hi,

Maybe one of you has an idea for the following ?

My script needs to ungzip a tar archive.
I want to give user feedback that this operation is being performed, without requiring user interaction (so, modal dialogs are out).

wx.BusyInfo is something that will probably work well in this case. You also might want to look at wx.ProgressDialog.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

wx.BusyInfo? I'm kicking myself for not seeing this before. Time to
write a new wiki page...

···

On 2/2/09, Robin Dunn <robin@alldunn.com> wrote:

wx.BusyInfo is something that will probably work well in this case. You
also might want to look at wx.ProgressDialog.

--
Josh English
Joshua.R.English@gmail.com

Hi S,
I managed to get my SVN (in cygwin) to work.
The new (SVN's) toasterbox.py solves the foreground colour problem (SetPopupTextColor).
However, the toasterboxes still appear in the same spot (one above the other) on the screen, so SetPopupPositionByInt still does not seem to work.
Below is the script (modified per Andrea's suggestions), that demonstrates the SetPopupPositionByInt problem (on my machine, at least).
Bye,
Ron.

#from wx.lib.agw import toasterbox as TB
import toasterbox as TB

def generator():
    i = 0
    while True:
        yield i
        i = (i + 1) % 4

def info_message_without_interaction(frame, msg, next_popup_position):
    """
    """
    average_char_width = 8
    x = 500
    y = 50
    tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
    tb.SetPopupPauseTime(10000)
    tb.SetPopupScrollSpeed(8)
    tb.SetPopupText(msg)
    tb.SetPopupSize((x,y))
    tb.SetPopupPositionByInt(next_popup_position)
    tb.SetPopupTextColor(wx.WHITE)
    tb.SetPopupBackgroundColor(wx.BLUE)
    tb.Play()

if __name__ == '__main__':

    app = wx.App(redirect=False)
    frame = wx.Frame(parent=None)
    panel = wx.Panel(frame)

    popup_position = generator()
    for i in range(5):
        next_popup_position = popup_position.next()
        msg = str(next_popup_position)
        info_message_without_interaction(frame, msg, next_popup_position)
        wx.MilliSleep(200)
        wx.SafeYield()
    app.MainLoop()

···

-----Original Message-----
From: Stephen Hansen [mailto:apt.shansen@gmail.com]
Sent: Monday, February 02, 2009 18:05
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] Re: ToasterBox's SetPopupTextColor dosen't work ?

It seems I have problems just connecting to the SVN (as I said, I
never used SVN before).
I'm trying to connect from a cygwin and I get:

$ svn co http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW
svn: OPTIONS of 'http://svn.wxwidgets.org/svn/wx/wxPython/3rdParty/AGW’:
could not connect to server (http://svn.wxwidgets.org)

I couldn't find a verbose option on SVN, so all I could think of was
to strace the command (below), but that didn't help much either, it
terms of clues.

What version of svn? Is it a cygwin build or a windows build? Maybe try installing a regular windows version and just svn'n from a regular command prompt: the syntax is identical.

Other then that: it works fine for me. Do you have some sort of HTTP proxy that sits on your internet? It could be interfering: svn is using webdav and some proxies and such don't pass those HTTP commands around right, I've heard.

You can't use svn+ssh because that requires you to have an actual ssh account on the host box. The command you entered -is- the right one and there's nothing else you enter to tell svn to do anything else differently, the problem has to be lower level then it.

--S

Hi Ron,

Hi S,
I managed to get my SVN (in cygwin) to work.
The new (SVN's) toasterbox.py solves the foreground colour problem (SetPopupTextColor).
However, the toasterboxes still appear in the same spot (one above the other) on the screen, so SetPopupPositionByInt still does not seem to work.
Below is the script (modified per Andrea's suggestions), that demonstrates the SetPopupPositionByInt problem (on my machine, at least).

As I told you yesterday, ToasterBox is *meant* to work in that way:
once the first ToasterBox is displayed (in whatever position you
choose at the beginning), all the subsequent ToasterBox windows will
pop up one on top of the other. So, if the first position is top-left
of the screen, all the others will be top left of the screen. The only
thing you control is the very first ToasterBox position (either in
absolute pixels coordinates using SetPopupPosition or by screen
location using SetPopupPositionByInt).

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Tue, Feb 3, 2009 at 8:33 AM, Barak, Ron wrote:

Hi Robin,

wx.ProgressDialog does look interesting, but - after reading Manning’s (wxPython in Action) “9.1.5 How can I display progress?” and www.wxpython.org/docs/api/wx.ProgressDialog-class.html, I cannot figure how I can use it in my application.
What I do is going through a list of “tgz” files, and for each checking if an un-tar-un-gzip directory already exists, and if it does not, I do a tar.extractall.

Since tar.extractall is only one command, I don’t understand how to incorporate it with ProgressDialog: how would ProgressDialog know of the progress the tar.extractall is having ?

Below is the un_tgz function I use to do the untarring.

Thanks,
Ron.

def un_tgz(app,tgz_save_states_paths):
“”"
“”"
popup_position = generator()

def_cwd = os.getcwd()
save_states_directories = []
for path in tgz_save_states_paths:
    next_popup_position = popup_position.next()
    cwd = os.path.dirname(path)
    """
    Temporarily change directory to the directory of the tgz file
    (save $cwd in cwd) so the untarring will be done in the
    same directory where the tgz file resides.
    """
    if (path.rfind(".tgz") != -1):
        tgz_dir = os.path.dirname(path)
        tgz_name = os.path.basename(path)
        (tgz_name_without_extension, extension) = os.path.splitext(tgz_name)
        save_state_name = os.path.join(tgz_dir,tgz_name_without_extension)
        save_states_directories.append(save_state_name)
        """
        If save_state sub-dir already exists in same directory as tgz_dir,
        do not unzip tgz_name, but give approperiate message.
        """   
        if glob.glob(save_state_name):
            msg = "Directory '%s' already exists in '%s'. '%s' will not be untarred!" % (tgz_name_without_extension,
                    tgz_dir, tgz_name)
            info_message_without_interaction(msg, next_popup_position)
            wx.MilliSleep(200)
            wx.SafeYield()
        else:
            msg = "Untarring '%s' into '%s'." % (tgz_name,tgz_dir)
            info_message_without_interaction(msg, next_popup_position)
            wx.MilliSleep(200)
            wx.SafeYield()
            print line()+". "+msg
            os.chdir(tgz_dir)
            tar = tarfile.open(path)
            tar.extractall()
            tar.close()
            os.chdir(cwd)
os.chdir(def_cwd)
return(save_states_directories)  

def generator():
i = 1
while True:
yield i
#i += 1
i = (i + 1) % 4

def info_message_without_interaction(msg, next_popup_position):
“”"
“”"
average_char_width = 8
x = 500
y = 50
frame = wx.Frame(parent=None)
panel = wx.Panel(frame)
tb = TB.ToasterBox(panel, TB.TB_SIMPLE, TB.DEFAULT_TB_STYLE, TB.TB_ONTIME)
tb.SetPopupPauseTime(10000)
tb.SetPopupScrollSpeed(10)
tb.SetPopupText(msg)
tb.SetPopupSize((x,y))
tb.SetPopupPosition((10,700))

tb.SetPopupTextColor(wx.GREEN)
tb.SetPopupBackgroundColor(wx.BLUE)
tb.Play()
···

-----Original Message-----
From: Robin Dunn [mailto:robin@alldunn.com]
Sent: Monday, February 02, 2009 22:37
To: wxpython-users@lists.wxwidgets.org
Subject: Re: [wxpython-users] How to create a non-interactive message-to-user in a window ?

Barak, Ron wrote:

Hi,

Maybe one of you has an idea for the following ?

My script needs to ungzip a tar archive.
I want to give user feedback that this operation is being performed,
without requiring user interaction (so, modal dialogs are out).

wx.BusyInfo is something that will probably work well in this case. You also might want to look at wx.ProgressDialog.


Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi Ron,

Hi Robin,

wx.ProgressDialog does look interesting, but - after reading Manning's
(wxPython in Action) "9.1.5 How can I display progress?" and
www.wxpython.org/docs/api/wx.ProgressDialog-class.html, I cannot figure how
I can use it in my application.
What I do is going through a list of "tgz" files, and for each checking if
an un-tar-un-gzip directory already exists, and if it does not, I do a
tar.extractall.

Since tar.extractall is only one command, I don't understand how to
incorporate it with ProgressDialog: how would ProgressDialog know of the
progress the tar.extractall is having ?

There is no way to do it, unless you use a thread or a separate
process to untar your files. My Suggestion would be to do something
like this:

dlg = wx.ProgressDialog("Extracting Tar Files", "I am working
hard...", parent=self,
                                     style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)

dlg.Pulse()

# Run in a separate thread
thread = TARThread(self)

while thread.isAlive():
    wx.MilliSleep(300)
    dlg.Pulse()

dlg.Destroy()
wx.SafeYield()

class TarThread(Thread):
    """ Worker thread class to attempt untar of files."""

    def __init__(self, notifyWindow):
        """
        Initialize the worker thread.

        **Parameters:**

        * notifyWindow: the window which will receive the notification when
                             this thread finishes the work.
        """

        Thread.__init__(self)

        self._notifyWindow = notifyWindow
        self.setDaemon(True)
        # This starts the thread running on creation, but you could
        # also make the GUI thread responsible for calling this
        self.start()

    def run(self):
        """ Run worker thread. """

        # This is the code executing in the new thread. Simulation of
        # a long process

        tar = tarfile.open(path)
        tar.extractall()
        tar.close()

        return

Or something along these lines. Not tested!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Tue, Feb 3, 2009 at 9:42 AM, Barak, Ron wrote:

Hi Andrea,
Thanks for your suggestion.
What you outlined below seems a bit too intricate just to give the user more elaborate feedback than using your ToasterBox.
I'll probably use your script below as a basis for another part of my program, where threads are essential.
Thanks and Bye,
Ron.

···

-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: Tuesday, February 03, 2009 11:51
To: wxpython-users@lists.wxwidgets.org
Subject: Re: Can tar.extractall incorporate with wx.ProgressDialog ? (was: RE: [wxpython-users] How to create a non-interactive message-to-user in a window ?)

Hi Ron,

On Tue, Feb 3, 2009 at 9:42 AM, Barak, Ron wrote:

Hi Robin,

wx.ProgressDialog does look interesting, but - after reading Manning's
(wxPython in Action) "9.1.5 How can I display progress?" and
www.wxpython.org/docs/api/wx.ProgressDialog-class.html, I cannot
figure how I can use it in my application.
What I do is going through a list of "tgz" files, and for each
checking if an un-tar-un-gzip directory already exists, and if it does
not, I do a tar.extractall.

Since tar.extractall is only one command, I don't understand how to
incorporate it with ProgressDialog: how would ProgressDialog know of
the progress the tar.extractall is having ?

There is no way to do it, unless you use a thread or a separate process to untar your files. My Suggestion would be to do something like this:

dlg = wx.ProgressDialog("Extracting Tar Files", "I am working hard...", parent=self,
                                     style=wx.PD_APP_MODAL | wx.PD_ELAPSED_TIME)

dlg.Pulse()

# Run in a separate thread
thread = TARThread(self)

while thread.isAlive():
    wx.MilliSleep(300)
    dlg.Pulse()

dlg.Destroy()
wx.SafeYield()

class TarThread(Thread):
    """ Worker thread class to attempt untar of files."""

    def __init__(self, notifyWindow):
        """
        Initialize the worker thread.

        **Parameters:**

        * notifyWindow: the window which will receive the notification when
                             this thread finishes the work.
        """

        Thread.__init__(self)

        self._notifyWindow = notifyWindow
        self.setDaemon(True)
        # This starts the thread running on creation, but you could
        # also make the GUI thread responsible for calling this
        self.start()

    def run(self):
        """ Run worker thread. """

        # This is the code executing in the new thread. Simulation of
        # a long process

        tar = tarfile.open(path)
        tar.extractall()
        tar.close()

        return

Or something along these lines. Not tested!

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

Hi Ron,

Hi Andrea,
Thanks for your suggestion.
What you outlined below seems a bit too intricate just to give the user more elaborate feedback than using your ToasterBox.
I'll probably use your script below as a basis for another part of my program, where threads are essential.

I am happy you found it useful. Anyway, remember that if you are
un-tarring very big files, your GUI will become unresponsive until
tar.extractall() has finished, blocking all user interaction with your
interface. You may also take a look at this Wiki page:

http://wiki.wxpython.org/LongRunningTasks

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Tue, Feb 3, 2009 at 10:01 AM, Barak, Ron wrote:

Rather than using tar.extractall, you could iterate over the result of
tar.getmembers(), calling tar.extract(member) for each one. Here's an
example (untested):

def default_progress_callback(stage, step, total):
    print "%s (Step %d of %d)" % (stage, step, total)

def extract_with_progress(tarfile,
progress_callback=default_progress_callback):
    members = tarfile.getmembers()
    for i, member in enumerate(members):
        progress_callback('Extracting...', i + 1, len(members))
        tarfile.extract(member)

In the attachment to
http://article.gmane.org/gmane.comp.python.wxpython/64836 there is a
'ProgressWindow' which is a wrapper round wx.ProgressDialog and can be
passed as a progress_callback function to provide the graphical
feedback, rather than just printing.

Hope that helps,

Simon

···

-----Original Message-----
From:
wxpython-users-bounces+simon.king=motorola.com@lists.wxwidgets
.org
[mailto:wxpython-users-bounces+simon.king=motorola.com@lists.w
xwidgets.org] On Behalf Of Barak, Ron
Sent: 03 February 2009 09:43
To: robin@alldunn.com
Cc: wxpython-users@lists.wxwidgets.org
Subject: Can tar.extractall incorporate with
wx.ProgressDialog ? (was: RE:[wxpython-users] How to create a
non-interactive message-to-user in awindow ?)

Hi Robin,

wx.ProgressDialog does look interesting, but - after reading
Manning's (wxPython in Action) "9.1.5 How can I display
progress?" and
www.wxpython.org/docs/api/wx.ProgressDialog-class.html, I
cannot figure how I can use it in my application.
What I do is going through a list of "tgz" files, and for
each checking if an un-tar-un-gzip directory already exists,
and if it does not, I do a tar.extractall.

Since tar.extractall is only one command, I don't understand
how to incorporate it with ProgressDialog: how would
ProgressDialog know of the progress the tar.extractall is having ?

Below is the un_tgz function I use to do the untarring.

Thanks,
Ron.

[snip]

Hi Andrea,

Ah, I guess I was too tired, as I missed that ;-(

How would you go about solving the problem of having more messages than screen height ?
In my application, I untar several files, and each file creates it’s own ToasterBox as feedback.
After several files are processed, the ToasterBoxes are printed above the top edge of the screen.

Bye,
Ron.

···

-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: Tuesday, February 03, 2009 11:02
To: wxpython-users@lists.wxwidgets.org
Subject: Re: ToasterBox’s SetPopupTextColor works, but SetPopupPositionByInt doesn’t (was: RE: [wxpython-users] Re: ToasterBox’s SetPopupTextColor dosen’t work ?)

Hi Ron,

On Tue, Feb 3, 2009 at 8:33 AM, Barak, Ron wrote:

Hi S,
I managed to get my SVN (in cygwin) to work.
The new (SVN’s) toasterbox.py solves the foreground colour problem (SetPopupTextColor).
However, the toasterboxes still appear in the same spot (one above the other) on the screen, so SetPopupPositionByInt still does not seem to work.
Below is the script (modified per Andrea’s suggestions), that demonstrates the SetPopupPositionByInt problem (on my machine, at least).

As I told you yesterday, ToasterBox is meant to work in that way:
once the first ToasterBox is displayed (in whatever position you choose at the beginning), all the subsequent ToasterBox windows will pop up one on top of the other. So, if the first position is top-left of the screen, all the others will be top left of the screen. The only thing you control is the very first ToasterBox position (either in absolute pixels coordinates using SetPopupPosition or by screen location using SetPopupPositionByInt).

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/