Re: [firstboot rhel5-branch] Fixed hiding of a dialog window when user clicked on the main window (#511984)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> @@ -43,6 +45,11 @@ class childWindow:
>      moduleName = (_("Network Setup"))
>      moduleClass = "reconfig"
>  
> +    needsparent = 1

Please use "True" instead of 1.

> @@ -166,6 +173,30 @@ class childWindow:
>          #Run rhn_register so they can register with RHN
>          pid = start_process("/usr/bin/system-config-network")
>  
> +        # get the x window id
> +        xid = None
> +        start = time.time()
> +
> +        # keep trying for 3 seconds
> +        while xid is None and (time.time() - start < 3):
> +            rc, out = commands.getstatusoutput('xwininfo -name' \
> +                    ' "Network Configuration" -int')
> +            pattern = re.compile("xwininfo:\sWindow\sid:\s(?P<xid>\d+)\s.*")
> +            for line in out.splitlines():
> +                m = pattern.match(line)
> +                if m:
> +                    xid = long(m.group("xid"))

I assume you're waiting to make sure that system-config-network has
started.  Did you encounter problems in testing that required waiting?

I think a more natural way to format this loop is:

   xid = None
   i = 0

   while not xid and i < 3:
      rc, out = blah

      pattern = blah
      for line in out.splitlines():
         m = blah
         if m:
            xid = blah

      i += 1
      time.sleep(1)

This avoids having to calculate time as well as avoids hammering the
system by calling xwininfo as fast as possible.  Note you're not doing
any sleeping in your loop so as soon as xwininfo exits unsuccessfully,
you're going to try it again.

Note also that you're not checking the return value of
commands.getstatusoutput.  I hope that out is "" in the case where the
commands fails.

> +        # if we have the xid, embed the window
> +        if xid is not None:

You can more simply say:

   if not xid:

> +            network_dlg = gtk.gdk.window_foreign_new(xid)
> +            self.parent.win.realize()
> +            network_dlg.set_transient_for(self.parent.win.window)
> +            network_dlg.set_modal_hint(True)
> +            # XXX if we keep the main window fullscreen,
> +            # and use alt+tab, the network window is gone forever
> +            self.parent.win.unfullscreen()
> +
>          flag = None
>          while not flag:
>              while gtk.events_pending():
> @@ -178,5 +209,8 @@ class childWindow:
>              else:
>                  time.sleep(0.1)
>  
> +        # make the main window fullscreen again
> +        self.parent.win.fullscreen()
> +
>          i.grab_remove ()
>          self.updateLabels()

I can't really speak to the window manipulations here, so I'll assume if
it works and avoids the problem of having the gnome panel appear over
top, it's probably okay.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux