Пример #1
0
    def _scan_folder(self, selected_folder: str, progress_tuple: tuple):
        """
        Walks through the given folder for any media file. When the media file is found, it is saved
        into a database. Once a database is created there is no need to repopulate it during every scan
        if the file still exists. The file is removed from the database if during the scan it is not in
        the folder it used to be. Same as if a new file appeared that was not there before.

        :param selected_folder: (string) path to the folder which is scanned
        :param progress_tuple: (tuple) -> (function, integer) tuple that contains a function to update a progress bar
                                and the number of total files in the selected folder
        """
        os.chdir(selected_folder)
        scanned_files = 0

        for folder_name, _, file_names in os.walk(selected_folder):
            self.current_folder = Folder(folder_name)

            for file_name in file_names:
                scanned_files += 1
                self._update_scanning_progress_bar(scanned_files,
                                                   progress_tuple)
                self._create_children_for_current_folder(file_name)

            self._pair_media_and_subs()

        # Return back to the directory of the program
        os.chdir(self._program_dir)
Пример #2
0
class PluginFolder:
	''' represents the plugins folder '''

	def __init__(self, pythonic_path):
		self.pythonic_path = pythonic_path
		self.folder = Folder(os.path.dirname(__file__) + "/" + self.pythonic_path.replace(".", "/"))

	# returns a list of plugin names
	def enumerate(self):
		return [ fname[:-3] for fname in self.folder.list_file_names() if fname.endswith(".py") ]

	# returns a module object representing a loaded plugin
	def load(self, plugin_name):
		if not self.folder.file_exists(plugin_name + ".py"):
			raise ImportError("module name \"{}\" not found".format(plugin_name))

		# create pythonic path
		prefix = self.pythonic_path
		if prefix != "":
			prefix += "."

		full_module_name = prefix + plugin_name

		# now no path is needed
		module_obj = __import__(full_module_name)

		# browse through the python module tree
		for next_dive in full_module_name.split(".")[1:]:
			module_obj = getattr(module_obj, next_dive)

		return module_obj
Пример #3
0
def tbfolder(experiments):
  ''' create temporary folder with a subset of experiment folders and tensorboard event files files for tensorboard '''
  
  tbf = Folder(folders=None, create=True) # temporary folder
  for f in experiments:
    tbf[f.name()].link(f.tb.filepaths())
  return tbf.path()
Пример #4
0
def displayFolders(path, userkey):
    folders = []
    if (path != userkey):  # if root
        folders.append({'name': '..', 'cdate': ''})

    # Get list of folders from datastore
    # Get Key object from thr urlsafe representation of Key
    user_key = ndb.Key(urlsafe=userkey)
    qry = Folder.query(Folder.owner == user_key)
    results = qry.fetch()
    for result in results:
        rpath = result.path
        start = rpath.find(path)
        if start != -1:
            sub = rpath[start + len(path) + 1:]
            if sub != '':
                if sub.find('/') == -1:
                    folders.append({
                        'name': sub,
                        'cdate': result.cdate,
                        'dnumber': result.dnumber,
                        'fnumber': result.fnumber,
                        'fsize': result.fsize
                    })

    if (path != userkey):
        qry = Folder.query(Folder.path == path)
        res = qry.fetch()
        parent_folder = res[0]
        parent_folder.dnumber = len(folders) - 1
        parent_folder.put()

    return folders
Пример #5
0
def main(stdscr):
    curses.curs_set(False)
    curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
    main_menu = ['Homework', 'Labs', 'Exit']
    base_folder = '/users/groups/cs324ta/grading'

    home = Folder(stdscr, base_folder)
    home.launch()
Пример #6
0
    def __init__(self, db, entryid, name, fobj):
        Folder.__init__(self, db)

        self.set_entryid(entryid)
        self.set_name(name)
        self.set_fobj(fobj)
        self.reset_items()

        self.custom_eprops_xml = self._init_custom_eprops_xml()
Пример #7
0
    def __init__(self, title='Title', children=None, active=True, spacing=1):
        ''' Create group. '''

        self._vbox = VBox(children, homogeneous=False)
        Folder.__init__(self,
                        title,
                        self._vbox,
                        active=active,
                        spacing=spacing)
Пример #8
0
    def __init__(self, db, entryid, name, fobj):
        Folder.__init__(self, db)

        self.set_entryid(entryid)
        self.set_name(name)
        self.set_fobj(fobj)
        self.reset_items()

        self.custom_eprops_xml = self._init_custom_eprops_xml()
Пример #9
0
    def __init__(self, db, entryid, name, fobj, msgstore):
        Folder.__init__(self, db)

        self.set_entryid(entryid)
        self.set_name(name)
        self.set_fobj(fobj)
        self.set_msgstore(msgstore)

        self.set_proptags(PropTags(self, self.get_config()))
        self.reset_def_cols()
Пример #10
0
    def __init__ (self, db, entryid, name, fobj, msgstore):
        Folder.__init__(self, db)

        self.set_entryid(entryid)
        self.set_name(name)
        self.set_fobj(fobj)
        self.set_msgstore(msgstore)

        self.set_proptags(PropTags(self, self.get_config()))
        self.reset_def_cols()
Пример #11
0
    def __init__ (self, db, gid, gn, gcentry):
        Folder.__init__(self, db)

        self.set_itemid(gid)
        self.set_name(gn)
        self.set_gcentry(gcentry)
        self.set_type(Folder.CONTACT_t)
        self.set_gdc(db.get_gdc())

        self.reset_contacts()
Пример #12
0
    def __init__ (self, db, gid, gn, gcentry):
        Folder.__init__(self, db)

        self.set_itemid(gid)
        self.set_name(gn)
        self.set_gcentry(gcentry)
        self.set_type(Folder.CONTACT_t)
        self.set_gdc(db.get_gdc())

        self.reset_contacts()
Пример #13
0
def init():
    log("Initialising folders.....")

    global master_dir, working_dir, server_dir, web_dir, backup_dir
    global folders

    working_dir = Folder(getcwd() + "/working_dir", name="Working Directory")
    working_dir.add_subdirs({"bin": "bin", "config": "config", "mods": "mods"})

    master_dir = Folder(config.get_value("master_dir"), name="Master Directory")
    master_dir.add_subdirs(
        {
            "mods": config.get_value("master_mods"),
            "client_mods": config.get_value("master_client_mods"),
            "config": config.get_value("master_config"),
            "bin": config.get_value("master_bin"),
        }
    )

    server_dir = Folder(config.get_value("server_dir"), name="Server Directory")
    server_dir.add_subdirs({"mods": "mods", "config": "config"})

    web_dir = Folder(config.get_value("web_dir"), name="Web Directory")

    backup_dir = Folder(config.get_value("backup_dir"), name="Backup Directory")

    folders = [master_dir, working_dir, server_dir, web_dir, backup_dir]

    log("Done!")

    if config.get_flag("no-backup"):
        command_chain.pop(0)
Пример #14
0
    def __init__(self, title='Title', children=None, spacing=3):
        ''' Create folder. '''

        self._vbox = VBox(children=children)
        Folder.__init__(self, title=title, child=self._vbox, active=True, spacing=spacing)
        self.style = theme.Window
        self.title.style = theme.Window.title
        self.child.style = theme.Window.child
        self.title.text = u'✖ '+title
        self._closed_prefix = u'✖ '
        self._opened_prefix = u'✖ '
Пример #15
0
    def __init__(self, db, fn, store=None):
        logging.debug('New BBContactsFolder: %s', fn)

        Folder.__init__(self, db, store)

        self.set_clean()
        self.set_type(Folder.CONTACT_t)
        self.set_itemid(fn)
        self.set_name(fn)

        self.reset_contacts()
Пример #16
0
    def __init__ (self, db, fid, gn, root_path):
        Folder.__init__(self, db)

        if fid[-1] != '/':
            fid += '/'

        self.set_itemid(fid)
        self.set_name(gn)
        self.set_root_path(root_path)
        self.set_type(Folder.CONTACT_t)
        self.reset_contacts()
Пример #17
0
    def __init__ (self, db, fn, store=None):
        logging.debug('New BBContactsFolder: %s', fn)

        Folder.__init__(self, db, store)
        
        self.set_clean()
        self.set_type(Folder.CONTACT_t)
        self.set_itemid(fn)
        self.set_name(fn)

        self.contacts = {}
Пример #18
0
    def __init__(self, db, fid, gn, root_path):
        Folder.__init__(self, db)

        if fid[-1] != '/':
            fid += '/'

        self.set_itemid(fid)
        self.set_name(gn)
        self.set_root_path(root_path)
        self.set_type(Folder.CONTACT_t)
        self.reset_contacts()
Пример #19
0
    def _manage_task(self, email_rule, now):
        # type: (EmailRule, datetime.datetime) -> None 
        """Add task to event_data_list, if there is message arrived in time span [last checked time, span_end]
        """ 
        time_span = int(email_rule.type.split('new-message-')[1])
        
        for folder_schema in email_rule.folders.all():
            folder = Folder(folder_schema, self._imap_client)
            time_start = email_rule.executed_at - datetime.timedelta(seconds=time_span)
            time_end = now - datetime.timedelta(seconds=time_span)

            logger.debug("time range %s %s" % (time_start, time_end))
            folder._search_scheduled_message(self.event_data_list, time_start, time_end)
Пример #20
0
    def _get_due_messages(self, email_rule, now):
        # type: (EmailRule, datetime.datetime) -> None 
        """Add task to event_data_list, if there is message arrived in time span [last checked time, span_end]
        """ 
        time_span = 0
        
        for folder_schema in email_rule.folders.all():
            folder = Folder(folder_schema, self._imap_client)
            time_start = email_rule.executed_at - datetime.timedelta(seconds=time_span)
            time_end = now - datetime.timedelta(seconds=time_span)

            logger.info("deadline range %s %s" % (time_start, time_end))
            folder._search_due_message(self.event_data_list, time_start, time_end)
Пример #21
0
def createFolder(path, user):
    folder = Folder()
    user_key = ndb.Key(urlsafe=user)
    folder.owner = user_key
    folder.path = path
    now = datetime.now()
    folder.cdate = now.strftime("%m/%d/%Y %H:%M:%S")
    folder.fsize = 0
    folder.fnumber = 0
    folder.dnumber = 0
    folder_key = folder.put()
Пример #22
0
    def __init__(self, title='Title', children=None, spacing=3):
        ''' Create folder. '''

        self._vbox = VBox(children=children)
        Folder.__init__(self,
                        title=title,
                        child=self._vbox,
                        active=True,
                        spacing=spacing)
        self.style = theme.Window
        self.title.style = theme.Window.title
        self.child.style = theme.Window.child
        self.title.text = u'✖ ' + title
        self._closed_prefix = u'✖ '
        self._opened_prefix = u'✖ '
Пример #23
0
    def _create_folder(self, unsupported_file):
        """create folder for unsupported extension

        :param unsupported_file: file object
        :return folder (str) created for purpose specific extension
        """
        if not self.possibilities:
            print(
                f"----\nNo folders found in directory. Please enter directory name for "
                f"{unsupported_file} file:\n")
        else:
            print("Please enter directory name:")

        while True:
            folder_name = input()
            checker = [
                True if char.isalnum() else False for char in folder_name
            ]
            if False not in checker and folder_name not in self.possibilities.keys(
            ):
                os.makedirs(folder_name)
                temp_folder = Folder(folder_name)
                self.folders.append(temp_folder)
                if unsupported_file.get_extension():
                    temp_folder.files.append(unsupported_file)
                return folder_name
            else:
                print("Invalid input")
Пример #24
0
    def get(self):
        # Getting value of session variable
        root = self.session.get('root')

        # Getting path of folder for deleting
        path = self.request.get('path')
        if path == '':
            full_path = root
        else:
            full_path = root + '/' + path

        # Delete folder from datastore. Query condition means it contain sub directory.
        qry = Folder.query(Folder.path >= full_path)
        results = qry.fetch()

        # Query result is not correct, because of condition for querying. So fix them.
        for result in results:
            result_path = result.path
            if result_path.find(path) is not -1:
                result.key.delete()

        # After deleting, make directory for redirecting.
        if path.find('/') is not -1:
            red_path = path[:path.rindex('/')]
        else:
            red_path = ''

        self.redirect('/?path=' + red_path)
Пример #25
0
def sync_download():
    try:
        init()
        f = Folder.get_by_path(DROPBOX_ROOT_FOLDER)
        sync(f)
    except:
        pass
Пример #26
0
def sync_download():
    try:
        init()
        f = Folder.get_by_path('/')
        sync(f)
    except:
        pass
Пример #27
0
    def _get_handler(self, key, cls=None, soft=False):
        # Synchronize
        handler = self._sync_filesystem(key)
        if handler is not None:
            # Check the class matches
            if cls is not None and not isinstance(handler, cls):
                error = "expected '%s' class, '%s' found"
                raise LookupError, error % (cls, handler.__class__)
            # Cache hit
            self.cache.touch(key)
            return handler

        # Check the resource exists
        if not self.fs.exists(key):
            if soft:
                return None
            raise LookupError, 'the resource "%s" does not exist' % key

        # Folders are not cached
        if self.fs.is_folder(key):
            return Folder(key, database=self)

        # Cache miss
        if cls is None:
            cls = self.get_handler_class(key)
        # Build the handler and update the cache
        handler = object.__new__(cls)
        self.push_handler(key, handler)

        return handler
def walk_through_folders(parent_folder, configuration_folder_structure, root_folder_name):
    if type(parent_folder) is not str:
        raise Exception

    if type(root_folder_name) is not str:
        raise Exception
    
    if type(configuration_folder_structure) is not ConfigurationFolder:
        raise Exception

    current_folder = Folder(root_folder_name)

    for dir in os.listdir(parent_folder):
        path = os.path.join(parent_folder, dir)

        if os.path.isdir(path):
            folder = Folder(dir)
            temp_conf_folder = None

            for conf_folder in configuration_folder_structure.all_folders():
                if str(folder) == str(conf_folder):
                    if conf_folder.is_excluded():
                        break
                    else:
                        current_folder.add_folder(walk_through_folders(os.path.join(str(parent_folder), str(folder)), conf_folder, str(folder)))
                        break                

        if os.path.isfile(path):
            file = File(dir)
            is_excluded = True

            for extension in configuration_folder_structure.all_extensions():
                if extension == file.extension():
                    is_excluded = False
                    break

            is_excluded_file = False
            for conf_file in configuration_folder_structure.all_files():
                if str(file) == str(conf_file):
                    if conf_file.is_excluded():
                        is_excluded_file = True
                        break
        
            if is_excluded is False and is_excluded_file is False:
                current_folder.add_file(file)

    return current_folder
Пример #29
0
def checkDuplicatedFolder(path):
    qry = Folder.query()
    qry = qry.filter(Folder.path == path)
    result = qry.fetch()
    if len(result) > 0:
        return True
    else:
        return False
Пример #30
0
 def initDB(self, parent):
     #creating the root folder
     #the number of elements is calculated like the following:
     #   MyUser, username, Folder, folder_id
     #     1   +    1   +    1  +     1           = 4
     #the root has no parent!
     folder1 = Folder(id="root",
                      parent=parent,
                      name="/",
                      numberOfElements=4)
     #confirming the adding of the folder
     folder1.put()
     #addint the blob collection and liking it to the user key which
     #is here represented by the parent variable
     collection = BlobCollection(id=parent.id())
     #confirming the adding of the collection
     collection.put()
Пример #31
0
 def on_mouse_motion(self, x, y, dx, dy):
     ''' Default mouse motion handler. '''
     if self._hit(x, y):
         return Folder.on_mouse_motion(self, x, y, dx, dy)
     else:
         if Widget._focused:
             Widget._focused.unfocus()
             Widget._focused = None
Пример #32
0
 def on_mouse_motion(self, x, y, dx, dy):
     ''' Default mouse motion handler. '''
     if self._hit(x,y):
         return Folder.on_mouse_motion(self,x,y,dx,dy)
     else:
         if Widget._focused:
             Widget._focused.unfocus()
             Widget._focused = None
Пример #33
0
    def __init__(self, id, IPListen, portListen, IPNext, portNext, bootstrap, k = 160):

        self.folder = Folder(id =portListen)
        self.filesManager = Trie()    

        self.IPListen = IPListen
        self.portListen = portListen
        self.IPNext = IPNext
        self.portNext = portNext
        self.k = k

        self.numElements = Bin(hex((2**k)-1)[2:])

        self.id = Bin(id)#aca va entrar la mac, debe crear una funcion que cuadre la mac como sha1
        print("my id:", self.id.getHex())

        self.listen.bind(tcp + self.IPListen + ":" + self.portListen)

        self.idPredecessor = None
        self.idSuccessor = None


        #query of disponible operations in the server's
        self.operation = {"updatePredecessor": self.updatePredecessor, 
                            "idIsInMySuccesor": self.idIsInMySuccesor,
                            "idIsInMyInterval": self.idIsInMyInterval,
                            "getSuccessor": self.getSuccessor,
                            "getServerID": self.getServerID,
                            "changeTheSuccessorInformation": self.changeTheSuccessorInformation,
                            "upload": self.upload,
                            "download": self.download,
                            "existsFileNow": self.existsFileNow,
                            "sendAllFiles": self.sendAllFiles }

        print("Server IP:", self.IPListen + ":" + self.portListen)

        if bootstrap:

            self.bootstrap()
            self.run()
        else :
            
            #self.find()
            self.addServerToChord()
            self.run()
Пример #34
0
 def sync_download(self):
     '''
     start to download all files in watching dir
     '''
     try:
         self.init()
         f = Folder.get_by_path('/')
         self.sync(f)
     except:
         pass
Пример #35
0
    def organize(self):
        """
        search for all folders and file with specific extensions stored within them
        """
        for position in os.listdir():
            if os.path.isdir(position):
                temp_folder = Folder(position)
                self.folders.append(temp_folder)
                self._add_all_files(temp_folder)

        self._validate_extensions()
Пример #36
0
    def create_gallery(self, folder_path):
        if not self.palette:
            return

        folder = Folder(os.path.basename(folder_path), folder_path)
        all_textures = folder.get_texture_files()
        images = []
        for texture_filename in all_textures:
            cur_texture = TextureBuilder().get_texture(texture_filename)
            if not cur_texture:
                continue

            image_data = cur_texture.get_pixels(self.palette)
            ht, wd, channels = image_data.shape
            image = QImage(image_data, wd, ht, channels * wd,
                           QImage.Format_RGB888)
            if not image.isNull():
                image = image.rgbSwapped()
                images.append(QPixmap.fromImage(image))
        self.gallery.populate(images=images, size=50)
        self.gallery.show()
Пример #37
0
def displayUserFolders(userkey):
    userFolders = []
    user_key = ndb.Key(urlsafe=userkey)
    qry = Folder.query(Folder.owner == user_key)
    results = qry.fetch()
    for result in results:
        path = result.path
        showPath = path[len(userkey):]
        showPath = showPath[1:] if showPath[:1] == '/' else showPath
        userFolders.append({'showPath': showPath})

    return userFolders
Пример #38
0
 def on_mouse_press(self, x, y, button, modifiers):
     if self._deleted:
        return
     self._action = ''
     if not Folder.on_mouse_press(self,x,y,button,modifiers) and self._hit(x,y):
         self._action = 'move'
     if ((x > (self.x+self.width-5)) and
         (x < (self.x+self.width+5)) and
         (y < (self.y-self.height+5)) and
         (y > (self.y-self.height-5))):
         self._action = 'resize'
     return True
Пример #39
0
 def on_mouse_press(self, x, y, button, modifiers):
     if self._deleted:
         return
     self._action = ''
     if not Folder.on_mouse_press(self, x, y, button,
                                  modifiers) and self._hit(x, y):
         self._action = 'move'
     if ((x > (self.x + self.width - 5)) and (x < (self.x + self.width + 5))
             and (y < (self.y - self.height + 5))
             and (y > (self.y - self.height - 5))):
         self._action = 'resize'
     return self._hit(x, y)
Пример #40
0
 def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
     if self._deleted:
         return
     if self._action == 'move':
         self.move(self.x + dx, self.y + dy)
         return True
     elif self._action == 'resize':
         width = self.width + dx
         height = self.height  #-dy
         self.resize(width, 0)
         return True
     else:
         return Folder.on_mouse_drag(self, x, y, dx, dy, button, modifiers)
Пример #41
0
 def on_mouse_drag(self, x, y, dx, dy, button, modifiers):
     if self._deleted:
        return
     if self._action == 'move':
         self.move(self.x+dx, self.y+dy)
         return True
     elif self._action == 'resize':
         width = self.width+dx
         height = self.height #-dy
         self.resize(width,0)
         return True
     else:
         return Folder.on_mouse_drag(self,x,y,dx,dy,button,modifiers)
Пример #42
0
def create(run_folder,tag=''):
  ''' create unique experiment folder '''
  
  rf = Folder(run_folder)
  
  #basename = 'e'+str(int(time.time()))+'_'+rf.name()
  dstr = datetime.now().strftime('%Y%m%d_%H%M_%S')
  basename =  dstr+'_'+rf.name()+'_'+tag
  name = basename
  i = 1
  while name in ezex.exfolder:
    name = basename + '_' + str(i)
    i = i+1
    if i > 100:
      raise RuntimeError('Could not create unique experiment folder')
      
  # ezex.exp_folder[name] = Folder(create=True)
  # exp = ezex.exp_folder[name]
  # exp.copy(rf)
  path = ezex.config['exfolder']+'/'+name
  os.mkdir(path)
  util.copy(run_folder,path,symlinks=True,ignore='.*')
  return path
Пример #43
0
def folder_from_path(path: Path, parent: Folder):
    size = 0
    last_modified = 0

    try:
        files = list(path.iterdir())
        size = sum(file.stat().st_size for file in files)
        last_modified = max(file.stat().st_mtime for file in files)
    except (ValueError, PermissionError):
        pass

    new_folder = Folder(path, parent, FolderStats(size, last_modified))

    return new_folder
Пример #44
0
def diplayFiles(path, userkey):
    qry = File.query(File.path == path)
    files = qry.fetch()
    fsize = 0
    for file in files:
        fsize += file.size

    if (path != userkey):
        qry = Folder.query(Folder.path == path)
        res = qry.fetch()
        parent_folder = res[0]
        parent_folder.fnumber = len(files)
        parent_folder.fsize = fsize
        parent_folder.put()
    return files
Пример #45
0
class PluginFolder:
    ''' represents the plugins folder '''
    def __init__(self, pythonic_path):
        self.pythonic_path = pythonic_path
        self.folder = Folder(
            os.path.dirname(__file__) + "/" +
            self.pythonic_path.replace(".", "/"))

    # returns a list of plugin names
    def enumerate(self):
        return [
            fname[:-3] for fname in self.folder.list_file_names()
            if fname.endswith(".py")
        ]

    # returns a module object representing a loaded plugin
    def load(self, plugin_name):
        if not self.folder.file_exists(plugin_name + ".py"):
            raise ImportError(
                "module name \"{}\" not found".format(plugin_name))

        # create pythonic path
        prefix = self.pythonic_path
        if prefix != "":
            prefix += "."

        full_module_name = prefix + plugin_name

        # now no path is needed
        module_obj = __import__(full_module_name)

        # browse through the python module tree
        for next_dive in full_module_name.split(".")[1:]:
            module_obj = getattr(module_obj, next_dive)

        return module_obj
Пример #46
0
def print_final_output(root_folder: Folder, root_path: Path):
    all_folders = list(root_folder.iter_folders())

    threshold = args.min_size_gb * pow(1024, 3)  # 1GB
    over_threshold = [
        f for f in all_folders if f.folder_stats.size > threshold
    ]

    over_threshold.sort(key=lambda f: f.folder_stats.size, reverse=True)
    over_threshold.sort(key=lambda f: depth(f.path, root_path), reverse=False)
    over_threshold.sort(key=lambda f: f.folder_stats.last_modified,
                        reverse=False)

    for folder in over_threshold[:30]:
        print(folder)
Пример #47
0
 def __getitem__(self, name):
     if name == 'users':
         users = UserCollection(self.request)
         users.__name__ = 'users'
         users.__parent__ = self
         return users
     elif name == 'groups':
         groups = GroupCollection(self.request)
         groups.__name__ = 'groups'
         groups.__parent__ = self
         return groups
     elif name == 'trash':
         trash = Trash(self.request)
         trash.__name__ = 'trash'
         trash.__parent__ = self
         return trash
     return Folder.__getitem__(self, name)
Пример #48
0
    def _find_or_create_folder(self, name):
        # type: (t.AnyStr) -> Folder
        """Return a reference to the folder with the given name.

        Returns:
            Folder: Folder associated with the passed in name
        """

        folder_schema = None  # type: FolderSchema
        try:
            folder_schema = FolderSchema.objects.get(
                imap_account=self._imap_account, name=name)
        except FolderSchema.DoesNotExist:
            folder_schema = FolderSchema(imap_account=self._imap_account,
                                         name=name)
            folder_schema.save()
            logger.debug("created folder %s in database" % name)

        return Folder(folder_schema, self._imap_client)
Пример #49
0
 def __init__(self, request, **kwargs):
     Folder.__init__(self, request, **kwargs)
     self.__name__ = ''
     self.__parent__ = None
     self.__acl__ = permissions.root_acl
Пример #50
0
    def __init__(self, content_id, data=None, **kwargs):

        Folder.__init__(self, content_id, data, **kwargs)
        BlockContainer.__init__(self, refs=True)

        self._content = ""
Пример #51
0
	def __init__(self, pythonic_path):
		self.pythonic_path = pythonic_path
		self.folder = Folder(os.path.dirname(__file__) + "/" + self.pythonic_path.replace(".", "/"))
    def __init__(self, content_id, data=None):

        Folder.__init__(self, content_id, data)
Пример #53
0
    def __init__(self, title='Title', children=None, active=True, spacing=1):
        ''' Create group. '''

        self._vbox = VBox(children, homogeneous=False)
        Folder.__init__(self, title, self._vbox, active=active, spacing=spacing)
Пример #54
0
 def addFolder(self, path):
     if not path in self.folders:
         folder = Folder(path, self)
         if folder.exists():
             self.folders[folder.getPath()] = folder