예제 #1
0
class Controller:
    """Controller for the application"""
    def __init__(self, root):
        """Initialize the controller"""
        self.model = ApplicationManager()
        self.view = MainView(self, root)

    def calculate_price(self):
        """
        Calculate the expected value of the booster box based on what is entered in the view entry widgets
        """
        self.view.box_prc_msg = str(self.model.calc_ev(self.view.rarity_amts))

    def get_set_names(self):
        """
        Retrieves all set list names

        :return: A list of all set list names
        """
        return self.model.set_names

    def update_current_set(self, event):
        """Updates the curr set information when a new list item is selected"""
        self.model.update_current_set(event)
        self.view.curr_set_msg = self.model.curr_set_message
        self.view.clear_set_info()
        self.view.update_set_info(self.model.rarities,
                                  self.model.avg_price_msg,
                                  self.model.num_cards_rarity,
                                  self.model.card_ratios)
예제 #2
0
파일: Upload.py 프로젝트: Fil0x/Cloudy
    def __init__(self):
        self.pending_uploads = {}
        for service in local.services:
            self.pending_uploads[service] = {}

        p = ApplicationManager()
        for s in p.get_services():
            getattr(self, "_{}_load".format(s.lower()))()
예제 #3
0
파일: Upload.py 프로젝트: Fil0x/Cloudy
    def __init__(self):
        self.pending_uploads = {}
        for service in local.services:
            self.pending_uploads[service] = {}

        p = ApplicationManager()
        for s in p.get_services():
            getattr(self, '_{}_load'.format(s.lower()))()
예제 #4
0
    def get_mem_map(self, mon, vmlist, time):
        #print vmlist

        appManager = ApplicationManager(time)
        appManager.initVirtualApplication(mon, vmlist)
        apps = appManager.loadBalance()
        #appManager.save(mon, apps)
        for app in apps:
            self.mapVM(app)

        memMap = self.mem_map(apps)

        return self.vcpu_map, memMap
예제 #5
0
    def get_vpcu_map(self, mon, vmlist, metrics, threshold, time):
        appManager = ApplicationManager(time)
        apps = appManager.initVirtualApplication(mon, vmlist)
        appManager.save(mon, apps)
        appsMapped = appManager.decide(metrics, threshold)
        mem_map = []
        for app in appsMapped:
            self.mapVM(app)
            if app.migrate == 1:
                mem_map.append(app)

        return self.vcpu_map, mem_map
예제 #6
0
파일: client.py 프로젝트: luucasv/InfraCom
def main():
	if len(sys.argv) != 3:
		print ('Usage : python3 client.py hostname port')
		sys.exit(1)

	host = sys.argv[1]
	port = int(sys.argv[2])
	
	try:
		NetworkManager.connect((host, port))
	except :
		print('Unable to connect. Maybe the server is not up.')
		sys.exit()
	
	print('Welcome to InfraComDrive 2.0.1\nCaso esta seja sua primeira vez utilizando a ferramenta, digite help')
	ApplicationManager.createDownloadFolder()
	while True:
		ApplicationManager.printWorkingDir()
		cmd = input().split()
		ApplicationManager.processCmd(cmd)
예제 #7
0
def start_RepTate(argv):
    """
    Main RepTate application. 
    
    :param list argv: Command line parameters passed to Reptate
    """
    # FOR DEBUGGING PURPOSES: Set Single or MultiThread (default)
    CmdBase.calcmode = CalcMode.singlethread

    GUI = False

    parser = argparse.ArgumentParser(
        description=
        'RepTate: Rheologhy of Entangled Polymers: Toolkit for the Analysis of Theory and Experiment.',
        epilog=
        '(c) Jorge Ramirez - [email protected] - UPM , Victor Boudara - U. Leeds (2018)'
    )
    parser.add_argument('-v',
                        '--verbose',
                        help='Write debug information to stdout',
                        action='store_true')
    parser.add_argument('-b',
                        '--batch',
                        help='Run in batch mode (no graphics)',
                        action='store_true')
    parser.add_argument('-V',
                        '--version',
                        help='Print RepTate version and exit',
                        action='store_true')
    parser.add_argument('finlist', nargs='*')

    args = parser.parse_args()

    if args.batch:
        CmdBase.mode = CmdMode.batch

    # Get files from command line
    dictfiles = get_argument_files(args.finlist)

    if args.version:
        print(ApplicationManager.intro)
        sys.exit()

    qapp = QApplication(sys.argv)
    app = ApplicationManager()

    # Handle files & open apps accordingly
    d = {
        app.extension: app.appname
        for app in list(app.available_applications.values())
    }
    for k in dictfiles.keys():
        if (k in d.keys()):
            app.new(d[k])
            appname = "%s%d" % (d[k], app.application_counter)
            ds, dsname = app.applications[appname].new("")
            app.applications[appname].datasets[dsname] = ds
            for f in dictfiles[k]:
                #app.applications[appname].datasets[dsname].do_open(f)
                ds.do_open(f)
            ds.do_plot()
            #app.applications[dsname].datasets[dsname].do_plot()
        else:
            print("File type %s cannot be opened" % k)

    sys.exit(app.cmdloop())
예제 #8
0
파일: Upload.py 프로젝트: Fil0x/Cloudy
 def save(self):
     p = ApplicationManager()
     for s in p.get_services():
         getattr(self, "_{}_save".format(s.lower()))()
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from PyQt4 import QtCore, QtGui
from ApplicationManager import ApplicationManager
		
		
		


if __name__ == '__main__':
	QtApp = QtGui.QApplication(sys.argv)
	samurai= ApplicationManager()
	samurai.run()
	sys.exit(QtApp.exec_())



예제 #10
0
def updateReviews(args):
	application = ApplicationManager(args.appId, getStorage())
	application.fetcherFactory = ReviewsFetcher
	application.parserFactory = ReviewsParser
	
	application.loadAndUpdateReviews(country = args.country, limit = args.limit)
예제 #11
0
파일: Upload.py 프로젝트: Fil0x/Cloudy
 def save(self):
     p = ApplicationManager()
     for s in p.get_services():
         getattr(self, '_{}_save'.format(s.lower()))()
예제 #12
0
 def vanila(self, mon, vmlist, time):
     appManager = ApplicationManager(time)
     apps = appManager.initVirtualApplication(mon, vmlist)
     appManager.save(mon, apps)
예제 #13
0
 def __init__(self, root):
     """Initialize the controller"""
     self.model = ApplicationManager()
     self.view = MainView(self, root)
	parser.add_argument('-s', '--storage', default='memory', type=str, help='Storage type (mongo or memory)')
	args = parser.parse_args()
	if args.id == 0:
		parser.print_help()
		raise SystemExit
	
	storage = None
	try:
		if args.storage == "mongo":
			storage = MongoStorage("AppStoreReviews")
		else:
			storage = MemoryStorage()	
	except Exception as ex:
		print ex
		raise SystemExit
	
	
	application = ApplicationManager(args.id, storage)
	application.fetcherFactory = ReviewsFetcher
	application.parserFactory = ReviewsParser
	
	application.loadAndUpdateReviews(country = args.country, limit = args.limit)
	
	reviews = application.getLatestReviews(country = args.country, limit = args.limit)
	
	for review in reviews:			
		print "[%d stars] %s by %s on %s" % (review.rating, review.version, review.author, review.date)
		print " (%s) %s" % (review.title, review.text)
		print "-------------------------------------------------------------------------------------------"
		
	
예제 #15
0
from ApplicationManager import ApplicationManager
from PyQt5 import QtWidgets
import LoggersConfig
from LoggersConfig import loggers

if __name__ == "__main__":
    import sys

    try:
        app = QtWidgets.QApplication(sys.argv)
        LoggersConfig.init_loggers()
        AppManager = ApplicationManager()
        AppManager.MainWindow.show()
        sys.exit(app.exec_())
        loggers['Application'].info('Exiting application!')

    except:
        loggers['Debug'].debug(f'Main: {sys.exc_info()}')