本文整理汇总了Python中utility.Utility.get_base_name方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.get_base_name方法的具体用法?Python Utility.get_base_name怎么用?Python Utility.get_base_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.get_base_name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _parse_dir
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_base_name [as 别名]
def _parse_dir(self):
dir_name = Utility.get_dir_name(self.current_path)
file_name = Utility.get_base_name(self.current_path)
# get files with extension stored in ext
file_list = []
for ext in self.extension_list:
file_list += glob.glob1(dir_name, ext)
# sort list
file_list = [f for f in file_list]
file_list.sort()
# current file index list
current_index = file_list.index(file_name)
# find the next file path
if current_index + 1 < len(file_list):
self._next_path = \
dir_name + '/' + file_list[current_index + 1]
else:
self._next_path = None
# find the previous file path
if current_index > 0:
self._previous_path = \
dir_name + '/' + file_list[current_index - 1]
else:
self._previous_path = None
return file_list
示例2: load
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_base_name [as 别名]
def load(self, filename, initial_page=0):
image_extensions = ['.bmp', '.jpg', '.jpeg', '.gif', '.png', '.pbm',
'.pgm', '.ppm', '.tiff', '.xbm', '.xpm', '.webp']
loader = LoaderFactory.create_loader(
Utility.get_file_extension(filename), set(image_extensions))
loader.progress.connect(self.load_progressbar_value)
try:
loader.load(filename)
except NoDataFindException as excp:
# Caso nao exista nenhuma imagem, carregamos a imagem indicando
# erro
from page import Page
print excp.message
q_file = QtCore.QFile(":/icons/notCover.png")
q_file.open(QtCore.QIODevice.ReadOnly)
loader.data.append(Page(q_file.readAll(), 'exit_red_1.png', 0))
self.comic = Comic(Utility.get_base_name(filename),
Utility.get_dir_name(filename), initial_page)
self.comic.pages = loader.data
self.current_directory = Utility.get_dir_name(filename)
self.path_file_filter.parse(filename)
示例3: is_last_file
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_base_name [as 别名]
def is_last_file(self):
file_name = Utility.get_base_name(self.current_path)
index = self.file_list.index(file_name)
return True if index == len(self.file_list) - 1 else False