def _start_recording(self, button): info("start recording") res = self.controller.Screencast() if res.success: info("Capturing screencast to {0}".format(res.filename)) button.set_sensitive(False) self.stop_button.set_sensitive(True)
def IsSuitable(self): try: self._backend() except dbus.exceptions.DBusException as ex: info("D-Bus GNOME Screencaster is not available: %s" % (str(ex))) return const.SUITABLE_NOT_SUITABLE if os.environ.get('XDG_CURRENT_DESKTOP') in \ ['GNOME', 'GNOME-Classic:GNOME', 'GNOME-Classic']: return const.SUITABLE_PREFERED else: return const.SUITABLE_NOT_SUITABLE
def SelectArea(self, widget, result_handler): """ Calls xwinfo to get area which user would like to record """ self.wroot = Gdk.get_default_root_window() self.wwidth = self.wroot.get_width() self.wheight = self.wroot.get_height() p = Popen(['xwininfo', '-frame'], stdout=PIPE, stderr=STDOUT, close_fds=True) (wid, _) = p.communicate() if p.wait() != 0: result_handler(False) x = y = width = height = None for i in wid.decode('utf-8').split('\n'): if i.lstrip().startswith('Absolute upper-left X:'): x = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Absolute upper-left Y'): y = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Width:'): width = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Height:'): height = int(i.split(' ')[len(i.split(' ')) - 1]) if x <= 0: width += x x = 1 # recordmydesktop accepts only values > 0 if y <= 0: height += y y = 1 if width + x > self.wwidth: width = self.wwidth - x if height + y > self.wheight: height = self.wheight - y self.x = x self.y = y self.width = width self.height = height info(self.x, self.y, self.width, self.height) result_handler(True) # true means - area was selected
def SelectArea(self, widget, result_handler): """ Calls xwinfo to get area which user would like to record """ self.wroot = Gdk.get_default_root_window() self.wwidth = self.wroot.get_width() self.wheight = self.wroot.get_height() p = Popen(['xwininfo', '-frame'], stdout=PIPE, stderr=STDOUT, close_fds=True) (wid, _) = p.communicate() if p.wait() != 0: result_handler(False) x = y = width = height = None for i in wid.decode('utf-8').split('\n'): if i.lstrip().startswith('Absolute upper-left X:'): x = int(i.split(' ')[len(i.split(' '))-1]) elif i.lstrip().startswith('Absolute upper-left Y'): y = int(i.split(' ')[len(i.split(' '))-1]) elif i.lstrip().startswith('Width:'): width = int(i.split(' ')[len(i.split(' '))-1]) elif i.lstrip().startswith('Height:'): height = int(i.split(' ')[len(i.split(' '))-1]) if x <= 0: width += x x = 1 # recordmydesktop accepts only values > 0 if y <= 0: height += y y = 1 if width + x > self.wwidth: width = self.wwidth - x if height + y > self.wheight: height = self.wheight - y self.x = x self.y = y self.width = width self.height = height info(self.x, self.y, self.width, self.height) result_handler(True) # true means - area was selected
def SelectArea(self, widget, result_handler): """ Calls xwinfo to get area which user would like to record """ self.wroot = Gdk.get_default_root_window() self.wwidth = self.wroot.get_width() self.wheight = self.wroot.get_height() xwininfo_com = ['xwininfo', '-frame'] (stdin, stdout, stderr) = os.popen3(xwininfo_com, 't') wid = stdout.readlines() stdin.close() stdout.close() stderr.close() x = y = width = height = None for i in wid: if i.lstrip().startswith('Absolute upper-left X:'): x = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Absolute upper-left Y'): y = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Width:'): width = int(i.split(' ')[len(i.split(' ')) - 1]) elif i.lstrip().startswith('Height:'): height = int(i.split(' ')[len(i.split(' ')) - 1]) if x <= 0: width += x x = 1 # recordmydesktop accepts only values > 0 if y <= 0: height += y y = 1 if width + x > self.wwidth: width = self.wwidth - x if height + y > self.wheight: height = self.wheight - y self.x = x self.y = y self.width = width self.height = height info(self.x, self.y, self.width, self.height) result_handler(True) # true means - area was selected