def __init__(self, parent, parent_logger): QObject.__init__(self, parent) logger = NicosLogger('client') logger.parent = parent_logger NicosClient.__init__(self, logger.warning) self._reg_keys = {} self._event_mask = ['livedata'] self.cache.connect(self.on_cache_event) self.connected.connect(self.on_connected_event)
def connect(self, conndata, eventmask=None): NicosClient.connect(self, conndata, self._event_mask)
def __init__(self): self._signals = [] self._estatus = STATUS_IDLE self._disconnecting = False NicosClient.__init__(self, print)
def __init__(self, conndata): NicosClient.__init__(self, self.put_error) # connection data as an object self.conndata = conndata # whether to suppress printing history and other info on connection self.quiet_connect = False # various state variables self.in_question = False self.in_editing = False self.tip_shown = False # number of automatic reconnect tries before giving up self.reconnect_count = 0 self.reconnect_time = 0 # current script, line within it and filename of script self.current_script = [''] self.current_line = -1 self.current_filename = '' # pending requests (i.e. scripts) in the daemon self.pending_requests = OrderedDict() # filename of last edited/simulated script self.last_filename = '' # instrument name from NICOS, pre-filled with server name self.instrument = conndata.host.split('.')[0] # script directory from NICOS self.scriptpath = '.' # execution mode of the NICOS session self.current_mode = MASTER # messages queueing up while the editor is running self.message_queue = [] # whether a stop is pending self.stop_pending = False # whether we are in debugging mode self.debug_mode = False # whether we are in spy mode (entering commands disabled) self.spy_mode = False # detected text-mode browser for help display self.browser = None # used for determining how much history to print by default self.tsize = terminalSize() # output stream to print to self.out = sys.stdout # uuid of the last simulation self.simuuid = '' # whether we display timestamps with subsecond precision self.subsec_ts = False # current ETA information self.cur_eta = '' # set up readline for line in DEFAULT_BINDINGS.splitlines(): readline.parse_and_bind(line) readline.set_completer(self.completer) readline.set_history_length(10000) self.histfile = os.environ.get('NICOS_HISTORY_FILE', path.expanduser('~/.nicoshistory')) if path.isfile(self.histfile): readline.read_history_file(self.histfile) self.completions = [] # set up "wakeup" pipe to notify readline of output and changed prompt self.wakeup_pipe_r, self.wakeup_pipe_w = os.pipe() # pre-set prompt to sane default self.set_status('disconnected')