本文整理汇总了Python中main.Main类的典型用法代码示例。如果您正苦于以下问题:Python Main类的具体用法?Python Main怎么用?Python Main使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Main类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Start
def Start():
ObjectContainer.art = R(PLUGIN_ART)
ObjectContainer.title1 = PLUGIN_NAME
DirectoryObject.thumb = R(PLUGIN_ICON)
DirectoryObject.art = R(PLUGIN_ART)
PopupDirectoryObject.thumb = R(PLUGIN_ICON)
PopupDirectoryObject.art = R(PLUGIN_ART)
if not Singleton.acquire():
log.warn("Unable to acquire plugin instance")
# Complete logger initialization
LoggerManager.setup(storage=True)
# Store current proxy details
Dict["proxy_host"] = Prefs["proxy_host"]
Dict["proxy_username"] = Prefs["proxy_username"]
Dict["proxy_password"] = Prefs["proxy_password"]
# Store current language
Dict["language"] = Prefs["language"]
# Start plugin
m = Main()
m.start()
示例2: show_login_window
def show_login_window(self):
# declaring variables
main = Main()
main.__init__()
lroot = Tk()
lroot.grid()
lroot.title = "Login"
lroot.wm_title("Login")
def login():
name = usrname.get()
passwd = usrpasswd.get()
if self.login_attempts < self.max_login_attempts:
if self.check(name, passwd):
print("User " + name + " logged in successfully")
lroot.destroy()
main.show_main()
print(self.login_attempts)
else:
self.login_attempts += 1
print("User " + name + " cannot be logged in: Wrong username/password")
else:
print("User " + name + " cannot be logged in: Too much login attempts. Login blocked")
# Adding elements to window
# input fields
# username
lbusrname = Label(lroot, text="Username:")
lbusrname.grid(pady=1, padx=1, row=0, column=0)
usrname = Entry(lroot)
usrname.grid(pady=1, padx=1, row=0, column=1)
# password
lbusrpasswd = Label(lroot, text="Passwort:")
lbusrpasswd.grid(pady=1, padx=1, row=1, column=0)
usrpasswd = Entry(lroot, show="*")
usrpasswd.grid(pady=1, padx=1, row=1, column=1)
# buttons
# login
btlogin = Button(lroot, text="Login", command=login)
btlogin.grid(pady=1, padx=1, row=2, column=1, sticky="E")
# closing the window
btquit = QuitButton(lroot)
btquit["text"] = "Schließen"
btquit.grid(pady=1, padx=1, row=2, column=1, sticky="W")
lroot.mainloop()
示例3: test_main_app_shows_adverts_menu
def test_main_app_shows_adverts_menu(self):
#Check that the output from the menu for the first option displays the 3 elements created at statup
main = Main()
ads = main.construct_adverts()
self.assertEqual(ads.count("ID"), 3)
#Now delete the adverts and make sure there is none
main.adverts_list = []
ads = main.construct_adverts()
self.assertEqual(ads.count("ID"), 0)
示例4: test_integration
def test_integration(self):
main = Main(game_path, 1)
main._load_players()
main._run_tournament()
self.assertTrue(os.path.exists(log_file))
video_visualizer = VideoVisualizer(24, config.Painter, file_mask,
'logs/tournament1')
video_visualizer.compile('test_video.mpg')
self.assertTrue(os.path.exists('logs/tournament1/test_video.mpg'))
示例5: test_updated_events_get_correctly_updated
def test_updated_events_get_correctly_updated(self):
#Checks that constructed adverts can get price and quantity modified correctly
main = Main()
advert = main.adverts_list[0]
old_price = advert.price
old_quantity = advert.quantity
advert = main.update_advert(advert, 'price', 99.99)
self.assertNotEqual(advert.price, old_price)
advert = main.update_advert(advert, 'quantity', 10)
self.assertNotEqual(advert.quantity, old_quantity)
示例6: testTheme
def testTheme(filename='test/index.html'):
#logging.basicConfig(filename='log.debug',level=logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)
main=Main()
filefetcher=FileFetcher(filename)
main.parseContent(filefetcher)
print main.themes
if True:
printTree(main.themes)
return
示例7: main
def main():
def update_splash(text):
splash.showMessage(text)
app.processEvents()
app = QtGui.QApplication(sys.argv)
splash_img = QtGui.QPixmap(':images/splash.png')
splash = QtGui.QSplashScreen(splash_img, QtCore.Qt.WindowStaysOnTopHint)
splash.show()
time.sleep(.001)
update_splash("Establishing Connection...")
if not dbConnection.default_connection():
QtGui.QMessageBox.critical(None, "No Connection!", "The database connection could not be established.")
sys.exit(1)
update_splash("Loading GUI...")
myapp = Main()
myapp.tab_loaded.connect(update_splash)
myapp.setWindowIcon(QtGui.QIcon(':images/post_laser_schedule.ico'))
myapp.show()
update_splash("GUI Loaded...")
myapp.load_tabs()
update_splash("Loading Actions...")
myapp.load_actions()
splash.finish(myapp)
sys.exit(app.exec_())
示例8: input
def input():
result={}
if request.method == 'POST':
text = request.form['text']
main = Main(text)
result = main.get_output()
threshold = int(request.form["threshold"])
order = main.get_order()
return render_template("input.html", result=result, threshold=threshold, order=order)
else:
return render_template("input.html", result=result)
示例9: updateNew
def updateNew(self):
logging.basicConfig(filename='update.log',level=logging.DEBUG)
#logging.getLogger('core').setLevel(logging.INFO)
main=Main(self.session)
main.parseContent(MainFetcher())
self.session.flush()
# themes, categories and emissions are loaded
# let's update the database with new emissions
# load all new videos XML files from
self.updateEmissions()
self.session.commit()
示例10: run
def run(self):
"""
Control DepDep start or stop and daemonize depdep ...
"""
depdep = Main(self.args.config, self.args.verbose, self.args.wipe)
try:
depdep.run()
except Exception, err_mess:
print err_mess
sys.exit(1)
示例11: test_stdin
def test_stdin(self, parse_args, stdin_patch):
emails = ['[email protected]']
stdin_patch.return_value = emails
options = self.test_options
options.stdin = True
parse_args.return_value = options
program = Main(test=True)
program.run()
eq_(program.get_matches(), emails)
eq_(stdin_patch.call_count, 1)
示例12: update
def update(request, rs_path_id):
search_form = SearchWay()
Main.update_a_record(rs_path_id)
return render(request,
'show/index.html',
{
'form': search_form,
'text_header': u'Quá trình kiếm kiếm đã diễn ra thuận lợi',
'rs_path': Path.objects.get(pk=rs_path_id),
'text_4_test': u'Kết quả đã tìm được: '
}
)
示例13: notify
def notify(request):
log.info('Request Notifying me')
# check if weekday is 1..5
today = datetime.utcnow()
if today.isoweekday() not in range(1, 6):
log.info('Weekend: no trading')
else:
main = Main(False)
main.notifyMe()
log.info('Request Me notified')
return http.HttpResponse()
示例14: test_url
def test_url(self, parse_args, file_patch):
emails = ['[email protected]']
file_patch.return_value = emails
options = self.test_options
options.path = 'test_path'
parse_args.return_value = options
program = Main(test=True)
program.run()
eq_(program.get_matches(), emails)
eq_(file_patch.call_count, 1)
eq_(file_patch.call_args, call('test_path'))
示例15: run
def run(self, edit):
#self.view.insert(edit, 0, "Hello, World!")
file_name = sublime.active_window().active_view().file_name()
log_analyzer = Main(file_name, sublime.packages_path() + "/settings.json", sublime.packages_path() + '/modified_file.log')
log_analyzer.perform_analysis()
#sublime.status_message("current_dir:" + os.path.abspath(os.curdir))
sublime.active_window().open_file(log_analyzer.output_filename)
sublime.active_window().active_view().settings().set("syntax", "log_analyzer.tmLanguage")
#sublime.active_window().active_view().settings().set("syntax", "Python/Python.tmLanguage")
#sublime.status_message(str(sublime.active_window().settings().get("syntax")))