Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
webbrowser.UnixBrowser Class Reference
Inheritance diagram for webbrowser.UnixBrowser:
Inheritance graph
[legend]
Collaboration diagram for webbrowser.UnixBrowser:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def open
def open_new
def open_new_tab

Public Attributes

 name
 basename
_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Static Public Attributes

 raise_opts = None
list remote_args = ['%action', '%s']
 remote_action = None
 remote_action_newwin = None
 remote_action_newtab = None
 background = False
 redirect_stdout = True
list args = ['%s']

Private Member Functions

def _invoke

Detailed Description

Parent class for all Unix browsers with remote functionality.

Definition at line 205 of file webbrowser.py.


Member Function Documentation

def webbrowser.UnixBrowser._invoke (   self,
  args,
  remote,
  autoraise 
) [private]

Definition at line 216 of file webbrowser.py.

00216 
00217     def _invoke(self, args, remote, autoraise):
00218         raise_opt = []
00219         if remote and self.raise_opts:
00220             # use autoraise argument only for remote invocation
00221             autoraise = int(autoraise)
00222             opt = self.raise_opts[autoraise]
00223             if opt: raise_opt = [opt]
00224 
00225         cmdline = [self.name] + raise_opt + args
00226 
00227         if remote or self.background:
00228             inout = io.open(os.devnull, "r+")
00229         else:
00230             # for TTY browsers, we need stdin/out
00231             inout = None
00232         p = subprocess.Popen(cmdline, close_fds=True, stdin=inout,
00233                              stdout=(self.redirect_stdout and inout or None),
00234                              stderr=inout, start_new_session=True)
00235         if remote:
00236             # wait five seconds. If the subprocess is not finished, the
00237             # remote invocation has (hopefully) started a new instance.
00238             time.sleep(1)
00239             rc = p.poll()
00240             if rc is None:
00241                 time.sleep(4)
00242                 rc = p.poll()
00243                 if rc is None:
00244                     return True
00245             # if remote call failed, open() will try direct invocation
00246             return not rc
00247         elif self.background:
00248             if p.poll() is None:
00249                 return True
00250             else:
00251                 return False
00252         else:
00253             return not p.wait()

Here is the caller graph for this function:

def webbrowser.UnixBrowser.open (   self,
  url,
  new = 0,
  autoraise = True 
)

Reimplemented from webbrowser.BaseBrowser.

Definition at line 254 of file webbrowser.py.

00254 
00255     def open(self, url, new=0, autoraise=True):
00256         if new == 0:
00257             action = self.remote_action
00258         elif new == 1:
00259             action = self.remote_action_newwin
00260         elif new == 2:
00261             if self.remote_action_newtab is None:
00262                 action = self.remote_action_newwin
00263             else:
00264                 action = self.remote_action_newtab
00265         else:
00266             raise Error("Bad 'new' parameter to open(); " +
00267                         "expected 0, 1, or 2, got %s" % new)
00268 
00269         args = [arg.replace("%s", url).replace("%action", action)
00270                 for arg in self.remote_args]
00271         success = self._invoke(args, True, autoraise)
00272         if not success:
00273             # remote invocation failed, try straight way
00274             args = [arg.replace("%s", url) for arg in self.args]
00275             return self._invoke(args, False, False)
00276         else:
00277             return True
00278 

Here is the call graph for this function:

def webbrowser.BaseBrowser.open_new (   self,
  url 
) [inherited]

Definition at line 151 of file webbrowser.py.

00151 
00152     def open_new(self, url):
00153         return self.open(url, 1)

Here is the call graph for this function:

def webbrowser.BaseBrowser.open_new_tab (   self,
  url 
) [inherited]

Definition at line 154 of file webbrowser.py.

00154 
00155     def open_new_tab(self, url):
00156         return self.open(url, 2)
00157 

Here is the call graph for this function:


Member Data Documentation

list webbrowser.BaseBrowser.args = ['%s'] [static, inherited]

Reimplemented in webbrowser.GenericBrowser.

Definition at line 142 of file webbrowser.py.

Reimplemented in webbrowser.Elinks, webbrowser.Opera, webbrowser.Galeon, and webbrowser.Mozilla.

Definition at line 213 of file webbrowser.py.

Reimplemented in webbrowser.GenericBrowser.

Definition at line 146 of file webbrowser.py.

Reimplemented in webbrowser.MacOSX, and webbrowser.GenericBrowser.

Definition at line 145 of file webbrowser.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.

Reimplemented in webbrowser.Opera, webbrowser.Galeon, and webbrowser.Mozilla.

Definition at line 208 of file webbrowser.py.

Reimplemented in webbrowser.Elinks.

Definition at line 214 of file webbrowser.py.

Reimplemented in webbrowser.Elinks, webbrowser.Opera, webbrowser.Galeon, and webbrowser.Mozilla.

Definition at line 210 of file webbrowser.py.

Reimplemented in webbrowser.Elinks, webbrowser.Opera, and webbrowser.Mozilla.

Definition at line 212 of file webbrowser.py.

Reimplemented in webbrowser.Elinks, webbrowser.Opera, webbrowser.Galeon, and webbrowser.Mozilla.

Definition at line 211 of file webbrowser.py.

list webbrowser.UnixBrowser.remote_args = ['%action', '%s'] [static]

Reimplemented in webbrowser.Elinks, webbrowser.Opera, webbrowser.Galeon, and webbrowser.Mozilla.

Definition at line 209 of file webbrowser.py.


The documentation for this class was generated from the following file: