Ejemplo n.º 1
0
 def process_args(self, title_or_ID=None,*, loc=None, limit=None,
         visible=None, **properties):
     check_type(int, limit, allowed=(None,))
     self.visible = visible
     self.location = loc
     self.fixed_IDs = None
     if loc is not None:
         if properties or title_or_ID or limit:
             raise SyntaxError("Parameter loc cannot be combined with "
                               "other parameters.")
     else:
         self.limit = limit
         if isinstance(title_or_ID, PositiveInt):
             self.fixed_IDs = (title_or_ID,)
         elif isinstance(title_or_ID, CollectionWithProps(PositiveInt)):
             self.fixed_IDs = tuple(title_or_ID)
         elif isinstance(title_or_ID, str):
             properties["title"] = title_or_ID
         elif isinstance(title_or_ID, CollectionWithProps(str, len=2)):
             # in this case, assume a (title, class) wininfo pair
             properties["title"], properties["wcls"] = title_or_ID
         elif not title_or_ID:
             if not properties:
                 self.location = "active"
                 # if no parameters specified, use the active window
         else:
             raise TypeError("First parameter title_od_ID: %s\nhas wrong "
                             "type: %s"%(title_or_ID, type(title_or_ID)))
         self._properties = properties
Ejemplo n.º 2
0
 def wait_num_change(self, num_change, timeout=5, pause_when_found=0.05,
         timestep=0.2):
     check_type(int, num_change)
     kwargs = {}
     if num_change >= 0:
         kwargs["min_wincount"] = self.num + num_change
     if num_change <= 0:
         kwargs["max_wincount"] = self.num + num_change
     windows_after = self.winsearch_object.wait_exist(timeout, pause_when_found,
             timestep, **kwargs)
     if windows_after is not False:
         if num_change >= 0:
             return windows_after - self
         return self - windows_after
     return False
Ejemplo n.º 3
0
 def pids_(self):
     for ID in self.IDs():
         x = self.adaptor.property_from_ID(ID, "pid")
         check_type(PositiveInt, x, allowed=(None,))
         yield x
Ejemplo n.º 4
0
 def wclasses_(self):
     for ID in self.IDs():
         x = self.adaptor.property_from_ID(ID, "wcls")
         check_type(str, x)
         yield x
Ejemplo n.º 5
0
 def titles_(self):
     for ID in self.IDs():
         x = self.adaptor.property_from_ID(ID, "title")
         check_type(str, x)
         yield x
Ejemplo n.º 6
0
 def wait_not_exist(self, timeout=5, timestep=0.2):
     ret = self.wait_exist(timeout, 0, timestep, min_wincount=0,
             max_wincount=0)
     check_type(bool, ret)
     return ret
Ejemplo n.º 7
0
 def geometries_(self):
     for ID in self.IDs():
         x = self.adaptor.property_from_ID(ID, "geometry")
         check_type(CollectionWithProps(int, len=4), x)
         yield x