当前位置: 首页>>代码示例>>Python>>正文


Python Interface.start方法代码示例

本文整理汇总了Python中Interface.Interface.start方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.start方法的具体用法?Python Interface.start怎么用?Python Interface.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interface.Interface的用法示例。


在下文中一共展示了Interface.start方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: print

# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import start [as 别名]
#!/usr/bin/python
__author__ = 'Volodimir Duda'

from Interface import Interface
from Core import Modify
import os, argparse

print("Running...")
parser = argparse.ArgumentParser(description="""
	Scan a directory for the purposes of converting FlyData generated
	using Perl scripts into an appropriate format. The Data is located within
	txt based files, but we need this data converted into the awd format along
	with internal data modifications to each file itself. 
	""")
parser.add_argument('loc', metavar="LOCATION", help="Location path to be scanned for text files")
args = parser.parse_args()
dirPath = args.loc
# Uncomment next line for testing purposes and/or uncomment line above
#dirPath = os.path.join(os.path.join(os.path.dirname(__file__)), "samples")
print(dirPath)
Interface.start(dirPath)
fileList = Interface.populateList()
Modify.main(fileList ,searchPath=dirPath)
print("Done!")
开发者ID:BSUTechDev,项目名称:FlyDataModifier,代码行数:26,代码来源:run.py

示例2: ImageViewer

# 需要导入模块: from Interface import Interface [as 别名]
# 或者: from Interface.Interface import start [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()
#.........这里部分代码省略.........
开发者ID:fdibaldassarre,项目名称:iw-image-viewer,代码行数:103,代码来源:ImageViewer.py


注:本文中的Interface.Interface.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。