def take_screenshot(self, widget): shot = Shot() shot.start() time.sleep(0.5) screenshot = gtk.gdk.Pixbuf.get_from_drawable( gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, shot.width, shot.height), gtk.gdk.get_default_root_window(), gtk.gdk.colormap_get_system(), shot.sX, shot.sY, 0, 0, shot.width, shot.height) filename = "/tmp/droplr.png" screenshot.save(filename, "png") self.upload_file_and_notify(filename)
def take_screenshot(self, widget): shot = Shot() shot.start() time.sleep(0.5) screenshot = gtk.gdk.Pixbuf.get_from_drawable( gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, True, 8, shot.width, shot.height), gtk.gdk.get_default_root_window(), gtk.gdk.colormap_get_system(), shot.sX, shot.sY, 0, 0, shot.width, shot.height) filename = "/tmp/droplr.png" screenshot.save(filename, "png") try: t = Thread(target=self.upload_file_and_notify, args=(filename,)).start() except Exception as e: print e print "Failed to start thread"
None, minimum_trigger=0.1) pulseblaster_clock = Pseudoclock('pulseblaster_clock', pulseblaster, 'clock', clock_minimum_period=1, wait_delay=0.5, timebase=0.1) clockline = ClockLine('clockline', pulseblaster_clock, 'flag 1') ni_card = ClockableDevice('ni_card', clockline, 'clock', clock_minimum_trigger=0.1, clock_minimum_period=1.2) ao = Output('ao', ni_card, 'ao0') shot.start() shot.wait(t=7, name='first_wait') ao.constant(t=0, value=7) ao.function(t=0, duration=7, function=np.sin, samplerate=20) shot.stop(1) print(time.time() - start_time) # TODO list: # If higher level labscript code subclasses or adds extra parent classes to # Device/Output/Instruction etc, then those classes need to cooperate with # this - calling super().__init__ methods etc, and we need to add settings # (class attributes for subclasses to override?) to Shot that allow higher # level code to replace the core library's base classes for Device etc with # its own.