def devices_are_ready(self): if not self.ImageCapture.are_devices() or \ not self.ImageCapture.capture_style: CA.dialog(message='Cannot capture: No devices found.') return False elif self.book.capture_style is not None and \ self.ImageCapture.capture_style != self.book.capture_style: CA.dialog(message='Cannot capture: Detected capture style ('+ self.ImageCapture.capture_style+') does not match scandata ('+ self.book.capture_style+')') return False else: if self.ImageCapture.capture_style == 'Single': for device in self.device_toggles['center']: if device.get_active(): return True CA.dialog(message='Cannot capture: No device selected.') return False elif self.ImageCapture.capture_style == 'Dual': l, r = False for ldevice, rdevice in zip(self.device_toggles['left'], self.device_toggles['right']): if ldevice.get_active(): l = True if rdevice.get_active(): r = True if l and r: return True if False in (l, r): missing = [side for k, side in {l:'left', r:'right'}.items() if not k ].join(', ') CA.dialog(message='Cannot capture: Please select a '+missing+' device.') return False
def handle_reshoot(self, widget): reshoot = CA.dialog(message='Are you sure you want to '+ 'reshoot the current spread?', Buttons={Gtk.STOCK_YES: Gtk.ResponseType.YES, Gtk.STOCK_NO: Gtk.ResponseType.NO}) if reshoot: self.handle_shoot(widget, reshoot=True)
def handle_reshoot(self, widget): reshoot = CA.dialog(message='Are you sure you want to ' + 'reshoot the current spread?', Buttons={ Gtk.STOCK_YES: Gtk.ResponseType.YES, Gtk.STOCK_NO: Gtk.ResponseType.NO }) if reshoot: self.handle_shoot(widget, reshoot=True)
def _exception_poll(self): #if (not self._should_poll or # not self.ProcessHandler._are_active_processes()): # self._is_polling_exceptions = False # self._should_poll = False # return False try: #print ('epoll') pid, exc_info = self.ProcessHandler._exception_queue.get_nowait() except Empty: return True else: exception, traceback = exc_info for _pid, _exception in self.ProcessHandler._handled_exceptions: identifier, cls = pid.split('.')[:2] if identifier + '.' + cls in _pid: return True self.ProcessHandler._handled_exceptions.append((pid, exception)) msg = 'Exception in ' + pid + ':\n' + traceback identifier = pid.split('.')[0] self.ProcessHandler.abort(identifier) ca.dialog(message=msg) return True
def _exception_poll(self): #if (not self._should_poll or # not self.ProcessHandler._are_active_processes()): # self._is_polling_exceptions = False # self._should_poll = False # return False try: #print ('epoll') pid, exc_info = self.ProcessHandler._exception_queue.get_nowait() except Empty: return True else: exception, traceback = exc_info for _pid, _exception in self.ProcessHandler._handled_exceptions: identifier, cls = pid.split('.')[:2] if identifier+'.'+cls in _pid: return True self.ProcessHandler._handled_exceptions.append((pid, exception)) msg = 'Exception in ' + pid + ':\n' + traceback identifier = pid.split('.')[0] self.ProcessHandler.abort(identifier) ca.dialog(message=msg) return True
def devices_are_ready(self): if not self.ImageCapture.are_devices() or \ not self.ImageCapture.capture_style: CA.dialog(message='Cannot capture: No devices found.') return False elif self.book.capture_style is not None and \ self.ImageCapture.capture_style != self.book.capture_style: CA.dialog(message='Cannot capture: Detected capture style (' + self.ImageCapture.capture_style + ') does not match scandata (' + self.book.capture_style + ')') return False else: if self.ImageCapture.capture_style == 'Single': for device in self.device_toggles['center']: if device.get_active(): return True CA.dialog(message='Cannot capture: No device selected.') return False elif self.ImageCapture.capture_style == 'Dual': l, r = False for ldevice, rdevice in zip(self.device_toggles['left'], self.device_toggles['right']): if ldevice.get_active(): l = True if rdevice.get_active(): r = True if l and r: return True if False in (l, r): missing = [ side for k, side in { l: 'left', r: 'right' }.items() if not k ].join(', ') CA.dialog(message='Cannot capture: Please select a ' + missing + ' device.') return False