本文整理汇总了Python中Interface.Interface.openImage方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.openImage方法的具体用法?Python Interface.openImage怎么用?Python Interface.openImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Interface.Interface
的用法示例。
在下文中一共展示了Interface.openImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImageViewer
# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import openImage [as 别名]
class ImageViewer():
def __init__(self, config_folder):
self.config_folder = config_folder
if not os.path.exists(self.config_folder):
os.mkdir(self.config_folder)
self.loadConfig()
self.setupInterface()
self.current_image = None
self.files_in_folder = []
# Inotify
if INOTIFY:
self.has_inotify = True
self.pyinotify_wm = pyinotify.WatchManager()
self.pyinotify_mask = pyinotify.IN_DELETE | pyinotify.IN_CREATE | pyinotify.IN_MOVED_FROM | pyinotify.IN_MOVED_TO
handler = InotifyEventHandler(self)
self.pyinotify_notifier = pyinotify.Notifier(self.pyinotify_wm, handler, timeout=INOTIFY_TIMEOUT)
self.pyinotify_wdd = {}
else:
self.has_inotify = False
def loadConfig(self):
self.config = configparser.SafeConfigParser(DEFAULT_CONFIG)
self.config_file = os.path.join(self.config_folder, 'config.txt')
self.config.read(self.config_file)
def getConfig(self, param):
return self.config.get(CONFIG_SECTION_DEFAULT, param)
def getConfigInt(self, param):
return int(self.config.get(CONFIG_SECTION_DEFAULT, param))
def getConfigColour(self, param):
col_str = self.getConfig(param)
colour = Gdk.RGBA()
colour.parse(col_str)
return colour
def getConfigBool(self, param):
if self.config.get(CONFIG_SECTION_DEFAULT, param).lower() == 'true':
return True
else:
return False
def setConfig(self, param, value):
self.config[CONFIG_SECTION_DEFAULT][param] = str(value)
def saveConfig(self):
self.config.write(open(self.config_file, 'w'))
def setupInterface(self):
width = self.getConfigInt(CONFIG_WINDOW_WIDTH)
height = self.getConfigInt(CONFIG_WINDOW_HEIGHT)
request_size = (width, height)
self.interface = Interface(self)
self.interface.resize(request_size)
if self.getConfigBool(CONFIG_WINDOW_FULLSCREEN):
self.interface.modeFullscreen(True)
self.interface.show()
## CONFIG INTERFACE GET
def getInterfaceBGColour(self):
return self.getConfigColour(CONFIG_BG_COLOUR)
def isInterfaceImageBGPattern(self):
return self.getConfig(CONFIG_IMAGE_BG_TYPE) == IMAGE_BG_TYPE_PATTERN
def isInterfaceImageBGAsMain(self):
return self.getConfig(CONFIG_IMAGE_BG_TYPE) == IMAGE_BG_TYPE_AS_APP
def isInterfaceImageBGColour(self):
return self.getConfig(CONFIG_IMAGE_BG_TYPE) == IMAGE_BG_TYPE_COLOUR
def getInterfaceImageBGColour(self):
return self.getConfigColour(CONFIG_IMAGE_BG_COLOUR)
## CONFIG INTERFACE SET
def setInterfaceBGColour(self, colour):
self.setConfig(CONFIG_BG_COLOUR, colour.to_string())
def setInterfaceImageBGTypePattern(self):
self.setConfig(CONFIG_IMAGE_BG_TYPE, IMAGE_BG_TYPE_PATTERN)
def setInterfaceImageBGTypeAsMain(self):
self.setConfig(CONFIG_IMAGE_BG_TYPE, IMAGE_BG_TYPE_AS_APP)
def setInterfaceImageBGTypeColour(self):
self.setConfig(CONFIG_IMAGE_BG_TYPE, IMAGE_BG_TYPE_COLOUR)
def setInterfaceImageBGColour(self, colour):
self.setConfig(CONFIG_IMAGE_BG_COLOUR, colour.to_string())
## START
def start(self, imagepath=None):
if imagepath is not None:
current_folder = os.path.dirname(imagepath)
self.files_in_folder = self.readFolder(current_folder)
self.current_image = self.openImage(imagepath)
self.inotifyAdd(current_folder)
self.setCurrentImagePosition()
#.........这里部分代码省略.........