Пример #1
0
    def __init__(self, channelDict={}, **kwargs):
        super(ChannelLibrary, self).__init__(channelDict=channelDict, **kwargs)
        self.load_from_library()
        self.logicalChannelManager = DictManager(
            itemDict=self.channelDict,
            displayFilter=lambda x: isinstance(x, LogicalChannel),
            possibleItems=NewLogicalChannelList)
        self.physicalChannelManager = DictManager(
            itemDict=self.channelDict,
            displayFilter=lambda x: isinstance(x, PhysicalChannel),
            possibleItems=NewPhysicalChannelList)

        if self.libFile:
            self.fileWatcher = FileWatcher.LibraryFileWatcher(
                self.libFile, self.update_from_file)
Пример #2
0
 def __init__(self, config):
     self.global_config = config
     self.logger = logging.getLogger()
     self.logger.debug("initializing")
     self.pluginmods = {}
     self.pluginobjs = {}
     if 'plugin_directory' not in config['defaults']:
         raise Exception("'plugin_directory' not defined in config file" %
                         (self.__module__))
     else:
         self.dname = config['defaults']['plugin_directory']
         sys.path.append(self.dname)
         if 'auto_delete_class_files' in config['defaults']:
             if config['defaults']['auto_delete_class_files'] == True:
                 self.auto_delete_class_files = True
             else:
                 self.auto_delete_class_files = False
         #initialize plugins
         plugins = self.find_plugins(self.dname)
         for (i, pname) in enumerate(plugins):
             self.enable_plugin(pname)
         self.file_watcher = FileWatcher.FileWatcher(
             self.dname, ["%s.py" % pname for pname in plugins])
Пример #3
0
    def __init__(self, **kwargs):
        super(InstrumentLibrary, self).__init__(**kwargs)
        self.load_from_library()
        if self.libFile:
            self.fileWatcher = FileWatcher.LibraryFileWatcher(
                self.libFile, self.update_from_file)

        #Setup the dictionary managers for the different instrument types
        self.AWGs = DictManager(
            itemDict=self.instrDict,
            displayFilter=lambda x: isinstance(x, AWGs.AWG),
            possibleItems=AWGs.AWGList)

        self.sources = DictManager(
            itemDict=self.instrDict,
            displayFilter=lambda x: isinstance(
                x, MicrowaveSources.MicrowaveSource),
            possibleItems=MicrowaveSources.MicrowaveSourceList)

        self.others = DictManager(
            itemDict=self.instrDict,
            displayFilter=lambda x: not isinstance(x, AWGs.AWG) and
            not isinstance(x, MicrowaveSources.MicrowaveSource),
            possibleItems=newOtherInstrs)
Пример #4
0
 def __init__(self, **kwargs):
     super(InstrumentLibrary, self).__init__(**kwargs)
     self.load_from_library()
     if self.libFile:
         self.fileWatcher = FileWatcher.LibraryFileWatcher(
             self.libFile, self.update_from_file)
Пример #5
0
def main():
    answer = ''
    if os.path.exists('account_info.txt'):
        answer = '2'
        info_file = open('account_info.txt', 'r')
        user_id = info_file.readline().rstrip('\n')
        password = info_file.readline().rstrip('\n')
        info_file.close()
    else:
        while not (answer == '1' or answer == '2'):
            answer = raw_input('Type 1 to create new account' + '\n' +
                               'Type 2 to sign in to existing account')
        user_id = raw_input('Enter username: '******'Enter password: '******'onedir'
    try:
        os.mkdir(root_folder)
    except OSError:
        pass

    files_to_send = Queue()
    files_to_delete = Queue()
    files_to_receive = Queue()
    deleted_files_to_receive = Queue()
    fwr = FileWatcher.FileWatcher(files_to_send, files_to_delete,
                                  files_to_receive, deleted_files_to_receive,
                                  root_folder)

    local_port = 9000
    server_ip = raw_input('Enter server IP address: ')
    server_port = 8000
    local_ip = get_local_ip()

    lch = LocalCommunicationHandler.LocalCommunicationHandler(
        server_ip, server_port, local_ip, local_port, root_folder,
        files_to_send, files_to_delete, files_to_receive,
        deleted_files_to_receive)

    fwr.start()
    signed_in = False
    if answer == '1':
        if lch.create_new_account(user_id, password):
            if lch.sign_in(user_id, password):
                signed_in = True
    elif answer == '2':
        if lch.sign_in(user_id, password):
            signed_in = True

    if signed_in:
        lch.start()
    else:
        print "Could not sign in; exiting..."
        exit_client(lch, fwr)

    while True:
        g = LocalGui.LocalGui(lch, fwr, user_id, password)
        if not g.on:
            s = raw_input('Enter any text to reopen GUI.')
            while s == '':
                s = raw_input('Enter any text to reopen GUI.')

    # Exiting procedure
    exit_client(lch, fwr)