本文整理汇总了Python中utility.Utility.get_dir_name方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.get_dir_name方法的具体用法?Python Utility.get_dir_name怎么用?Python Utility.get_dir_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.get_dir_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir_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)
示例2: _parse_dir
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir_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
示例3: __init__
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir_name [as 别名]
def __init__(self, controller, parent=None):
# QtGui.QDialog.__init__(self, parent)
super(BookmarkManagerDialog, self).__init__(parent=parent)
self.ui = Ui_Bookmark_Dialog()
self.ui.setupUi(self)
self.controller = controller
path = Utility.get_dir_name(
controller.model.settings_manager.settings.fileName())
self.db = QtSql.QSqlDatabase().addDatabase("QSQLITE")
self.db.setDatabaseName(path + u'/bookmark.db')
if self.db.open():
self.model = QtSql.QSqlTableModel(self, self.db)
self.model.setTable('Bookmark')
self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
self.model.select()
self.model.setHeaderData(2, QtCore.Qt.Horizontal, "Name")
self.model.setHeaderData(3, QtCore.Qt.Horizontal, "Page")
self.ui.bookmark_table.setModel(self.model)
self.ui.bookmark_table.hideColumn(0)
self.ui.bookmark_table.hideColumn(1)
self.ui.bookmark_table.hideColumn(4)
self.ui.bookmark_table.horizontalHeader().setResizeMode(
2, QtGui.QHeaderView.Stretch)
self.ui.bookmark_table.horizontalHeader().setResizeMode(
3, QtGui.QHeaderView.ResizeToContents)
self.ui.button_remove.clicked.connect(self._remove_table_item)
self.ui.button_load.clicked.connect(self._get_comic_to_open)
selection = self.ui.bookmark_table.selectionModel()
selection.selectionChanged.connect(self.selection_changed)
self.no_cover_label = self.ui.page_image_label.pixmap(
).scaledToWidth(self.width() * self.SCALE_RATIO,
QtCore.Qt.SmoothTransformation)
self.ui.page_image_label.setPixmap(self.no_cover_label)
print '[INFO] Database load!'
else:
print "[ERROR] Unable to create db file!"
示例4: get_settings_path
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir_name [as 别名]
def get_settings_path():
path = Utility.get_dir_name(SettingsManager().settings.fileName())
return path + u'/bookmark.db'