本文整理汇总了Python中application.Application类的典型用法代码示例。如果您正苦于以下问题:Python Application类的具体用法?Python Application怎么用?Python Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Application类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainApplication
class MainApplication(tk.Tk):
"""Container for all frames within the application"""
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
# initialize menu
self.config(menu=MenuBar(self))
self.title("FIFA 16 Auto Buyer")
self.geometry("950x650-5+40")
self.minsize(width=650, height=450)
# bind ctrl+a
if platform == "darwin":
self.bind_class("Entry", "<Command-a>", self.selectall)
else:
self.bind_class("Entry", "<Control-a>", self.selectall)
self.status = StatusBar(self)
self.status.pack(side="bottom", fill="x")
self.status.set_credits("0")
self.appFrame = Application(self)
self.appFrame.pack(side="top", fill="both", expand="True")
def selectall(self, e):
e.widget.select_range(0, tk.END)
return "break"
示例2: do_test_2
def do_test_2():
"2nd Watsup Test"
filename = 'atestfile.txt'
if os.path.exists(filename):
os.remove(filename)
app = Application()
try:
app.connect_(title ='Simple Form')
except WindowNotFoundError:
app.start_(r'examples\simple.exe')
form = app.SimpleForm
form.Edit.SetText(filename)
sleep(.6)
print 'clicking button to create file'
form.CreateFile.Click()
# now check that the file is there
if os.path.exists(filename):
print 'file %s is present' % filename
else:
print "file %s isn't there" % filename
form.MenuSelect("File->Exit")
示例3: __init__
def __init__(self, *args, **kwargs):
QtGui.QMainWindow.__init__(self, *args, **kwargs)
self._app = Application.instance()
title = "ChromaClub"
if self._app.isTestNet:
title += " [testnet]"
title += " - " + clubAsset['monikers'][0]
self.setWindowTitle(title)
self.setWindowIcon(QtGui.QIcon(':icons/chromaclub.png'))
self.resize(900, 550)
self.move(Application.instance().desktop().screen().rect().center() - self.rect().center())
self.setCentralWidget(QtGui.QStackedWidget())
self.overviewpage = OverviewPage(self)
self.sendpage = SendPage(self)
self.chatpage = ChatPage(self)
self.centralWidget().addWidget(self.overviewpage)
self.centralWidget().addWidget(self.sendpage)
self.centralWidget().addWidget(self.chatpage)
self._create_actions()
self._create_menu_bar()
self._create_tool_bar()
self._create_status_bar()
self._create_tray_icon()
self._create_tray_icon_menu()
self._app.statusChanged.connect(self._status_changed)
示例4: _process_files
def _process_files(mediafile, subtitlesfile):
print "Processing the files now .."
print "Media File --> " + mediafile
print "Subtitles File -->" + subtitlesfile
application = Application(mediafile, subtitlesfile)
application.speech_recognition()
示例5: test_get_json_should_return_expected_json
def test_get_json_should_return_expected_json(self):
id = 66
name = "name"
available_version = "available_version"
download_location = "download_location"
relitive_install_path = "relitive_install_path"
executable_path = "executable_path"
installed_path = "installed_path"
icon = "icon"
current_version = "current_version"
shortcut_path = "shortcut_path"
app = Application(id, name, available_version, download_location, relitive_install_path, executable_path, installed_path, icon, current_version, shortcut_path)
expected_json = {
"id": 66,
"name": {
"en-us": "name",
},
"available_version": "available_version",
"download_location": "download_location",
"relitive_install_path": "relitive_install_path",
"executable_path": "executable_path",
"installed_path": "installed_path",
"icon": "icon",
"current_version": "current_version",
"shortcut_path": "shortcut_path",
}
actual = json.loads(app.get_json())
self.assertEquals(expected_json, actual)
示例6: show_application
def show_application(self, application, fullscreen, context):
"""
Render <application> widget with the given name and the given context.
"""
if isinstance(application, (str, unicode)):
tmp = self.theme.application.get(application)
if not tmp:
return log.error('no application named %s', application)
application = tmp(size=self.size, context=context)
self.add_layer(application, sibling=self.applications_idx)
elif application is None:
application = Application(self.size, [], context=context)
self.add_layer(application, sibling=self.applications_idx)
else:
application.visible = True
self.applications.remove(application)
# TODO: add show/hide/remove/unparent/whatever here
for l in self.layer:
l.visible = not fullscreen
if l == self.applications_idx:
break
if self.applications:
self.applications[-1].visible = False
self.applications.append(application)
return application
示例7: main
def main():
parser = ArgumentParser(description=
'MegaMinerAI PyVis - Python Implementation of the Visualizer')
parser.add_argument('glog', type=str, nargs='*',
help='Optional glogs to open in the visualizer.')
parser.add_argument('-f', dest='fullscreen', action='store_true',
help='Start in fullscreen mode')
parser.add_argument('-a', dest='arena', metavar='server', type=str, nargs=1,
help='Enables arena mode querying from the given url')
parser.add_argument('-s', dest='spectate',
metavar=('server', 'gamenumber'), nargs=2, type=str,
help='Spectates on gamenumber at server.')
args = parser.parse_args()
app = Application(fullscreen=args.fullscreen)
'''
renderer = Renderer()
renderer.register_with_app(app)
app.request_update_on_draw(Test(renderer).update)
r = Renderer.Rectangle(1, 2, 20, 30, renderer=renderer)
try:
r = Renderer.Rectangle(40, 40, 20, 30)
except:
pass
'''
app.run(args.glog)
示例8: test_detail_url
def test_detail_url(self):
self.print_header()
oracle = Application({
'host_name': 'test',
'name': 'test',
'type': 'generic',
})
url = MonitoringDetail({
'host_name': 'test',
'application_name': 'test',
'application_type': 'generic',
'monitoring_type': 'URL',
'monitoring_0': 'oracle://dbadm:[email protected]:1522/svc',
})
oracle.monitoring_details.append(url)
oracle.resolve_monitoring_details()
self.assert_(len(oracle.urls) == 1)
# consol app_db_oracle class will call wemustrepeat() to create
# a fake LOGIN-detail, so there is a oracle.username
self.assert_(oracle.urls[0].username == 'dbadm')
self.assert_(oracle.urls[0].password == 'pass')
self.assert_(oracle.urls[0].hostname == 'dbsrv')
self.assert_(oracle.urls[0].port == 1522)
# will be without the / in the consol app_db_oracle class
self.assert_(oracle.urls[0].path == '/svc')
示例9: __init__
def __init__(self, pkg, cfg):
Application.__init__(self, pkg, cfg)
self.type_id = 'inputmethod'
self.categories = [ 'Addons', 'InputSources' ]
self.icon = 'system-run-symbolic'
self.cached_icon = False
self.requires_appdata = True
示例10: __init__
def __init__(self, pkg, cfg):
Application.__init__(self, pkg, cfg)
self.type_id = u'codec'
self.requires_appdata = True
self.categories = []
self.cached_icon = False
self.icon = 'application-x-executable'
self.categories.append(u'Addons')
self.categories.append(u'Codecs')
# use the pkgname as the id
app_id = pkg.name
app_id = app_id.replace('gstreamer1-', '')
app_id = app_id.replace('gstreamer-', '')
app_id = app_id.replace('plugins-', '')
self.set_id('gstreamer-' + app_id)
# map the ID to a nice codec name
self.codec_name = {}
csvfile = open('../data/gstreamer-data.csv', 'r')
data = csv.reader(csvfile)
for row in data:
if row[1] == '-':
continue
codec_id = row[0][31:-3]
self.codec_name[codec_id] = row[1].split('|')
csvfile.close()
示例11: setUp
def setUp(self):
self.generator = Generator()
self.generator.setup_logging()
self.hosts = {}
self.applications = {}
Application.init_classes([
os.path.join(os.path.dirname(__file__), '../recipes/default/classes'),
os.path.join(os.path.dirname(__file__), 'recipes/test10/classes')])
MonitoringDetail.init_classes([
os.path.join(os.path.dirname(__file__), '../recipes/default/classes'),
os.path.join(os.path.dirname(__file__), 'recipes/test10/classes')])
pass
row = ['drivelsrv', '11.120.9.10', 'Server', 'Red Hat 6.0', '', 'vs', '7x24', '2nd floor', 'ps']
final_row = { }
for (index, value) in enumerate(['host_name', 'address', 'type', 'os', 'hardware', 'virtual', 'notification_period', 'location', 'department']):
final_row[value] = [None if row[index] == "" else row[index]][0]
h = Host(final_row)
self.hosts[h.host_name] = h
row = ['drivel', 'mysql', '', '', '', 'drivelsrv', '7x24']
final_row = { }
for (index, value) in enumerate(['name', 'type', 'component', 'version', 'patchlevel', 'host_name', 'check_period']):
final_row[value] = [None if row[index] == "" else row[index]][0]
a = Application(final_row)
#a.__init__(final_row)
self.applications[a.fingerprint()] = a
setattr(a, "host", self.hosts[a.host_name])
示例12: MainApplication
class MainApplication(tk.Tk):
"""Container for all frames within the application"""
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
#initialize menu
self.config(menu=MenuBar(self))
self.title('FIFA 16 Auto Buyer')
self.geometry('850x650-5+40')
self.minsize(width=650, height=450)
# bind ctrl+a
if(platform == 'darwin'):
self.bind_class("Entry", "<Command-a>", self.selectall)
else:
self.bind_class("Entry", "<Control-a>", self.selectall)
self.status = StatusBar(self)
self.status.pack(side='bottom', fill='x')
self.status.set_credits('0')
self.appFrame = Application(self)
self.appFrame.pack(side='top', fill='both', expand='True')
def selectall(self, e):
e.widget.select_range(0, tk.END)
return 'break'
示例13: start
def start(self, init=True):
"""Start Instance."""
self.path_user_installation = join(self.path_run_dir, \
"cloudooo_instance_%s" % self.port)
if init and exists(self.path_user_installation):
removeDirectory(self.path_user_installation)
# Create command with all parameters to start the instance
self.command = [join(self.office_binary_path, self._bin_soffice),
'-headless',
'-invisible',
'-nocrashreport',
'-nologo',
'-nodefault',
'-norestore',
'-nofirststartwizard',
'-accept=socket,host=%s,port=%d;urp;' % (self.hostname, self.port),
'-env:UserInstallation=file://%s' % self.path_user_installation,
'-language=%s' % self.default_language,
]
# To run soffice.bin, several environment variables should be set.
env = self.environment_dict.copy()
env.setdefault("LANG", "en_US.UTF-8")
env["HOME"] = self.path_user_installation
env["TMP"] = self.path_user_installation
env["TMPDIR"] = self.path_user_installation
self._startProcess(self.command, env)
self._cleanRequest()
Application.start(self)
示例14: stop
def stop(self):
"""Stop the instance by pid. By the default
the signal is 15."""
Application.stop(self)
if socketStatus(self.hostname, self.port):
self._releaseOpenOfficePort()
self._cleanRequest()
示例15: init_class_cache
def init_class_cache(self):
Datasource.init_classes(self.classes_path)
logger.debug("init Datasource classes (%d)" % len(Datasource.class_factory))
Datarecipient.init_classes(self.classes_path)
logger.debug("init Datarecipient classes (%d)" % len(Datarecipient.class_factory))
Application.init_classes(self.classes_path)
logger.debug("init Application classes (%d)" % len(Application.class_factory))
MonitoringDetail.init_classes(self.classes_path)
logger.debug("init MonitoringDetail classes (%d)" % len(MonitoringDetail.class_factory))