本文整理汇总了Python中folder.Folder类的典型用法代码示例。如果您正苦于以下问题:Python Folder类的具体用法?Python Folder怎么用?Python Folder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Folder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tbfolder
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()
示例2: __init__
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: __init__
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()
示例4: __init__
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()
示例5: __init__
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()
示例6: init
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)
示例7: __init__
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'✖ '
示例8: __init__
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()
示例9: __init__
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 = {}
示例10: sync_download
def sync_download():
try:
init()
f = Folder.get_by_path('/')
sync(f)
except:
pass
示例11: sync_download
def sync_download():
try:
init()
f = Folder.get_by_path(DROPBOX_ROOT_FOLDER)
sync(f)
except:
pass
示例12: walk_through_folders
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
示例13: on_mouse_motion
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
示例14: sync_download
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
示例15: on_mouse_press
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