Exemple #1
0
 def input(self):
     if self._login is None or self._password is None:
         return None
     if self._dashboard is None:
         self._dashboard = Dashboard(self.driver)
     self._dashboard.input(self._login, self._password)
     return self
Exemple #2
0
def run(voc, config):

    # FIXME: Allow MQTT credentials in voc.conf

    client_id = 'voc_{hostname}_{time}'.format(hostname=hostname(),
                                               time=time())

    mqtt_config = read_mqtt_config()

    mqtt = paho.Client(client_id=client_id, clean_session=False)
    mqtt.username_pw_set(username=mqtt_config['username'],
                         password=mqtt_config['password'])
    mqtt.tls_set(certs.where())

    mqtt.on_connect = on_connect
    mqtt.on_disconnect = on_disconnect
    mqtt.on_publish = on_publish
    mqtt.on_message = on_message
    mqtt.on_subscribe = on_subscribe

    mqtt.event_connected = Event()

    mqtt.connect(host=mqtt_config['host'], port=int(mqtt_config['port']))
    mqtt.loop_start()

    interval = int(config['interval'])
    _LOGGER.info(f'Polling every {interval} seconds')

    entities = {}

    while True:

        if not mqtt.event_connected.is_set():
            _LOGGER.debug('Waiting for MQTT connection')
            mqtt.event_connected.wait()
            _LOGGER.debug('Connected')

        available = True
        for vehicle in voc.vehicles:
            if vehicle not in entities:
                _LOGGER.debug('creating vehicle %s', vehicle)

                dashboard = Dashboard(vehicle)
                dashboard.configurate(**config)

                entities[vehicle] = [
                    Entity(mqtt, instrument, config)
                    for instrument in dashboard.instruments
                ]

            for entity in entities[vehicle]:
                _LOGGER.debug('%s: %s', entity.instrument.full_name,
                              entity.state)
                entity.publish_discovery()
                entity.publish_availability(available)
                if available:
                    entity.publish_state()

        sleep(interval)
        available = voc.update()
Exemple #3
0
class Login(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi("ui/login.ui", self)

        username = self.findChild(QLineEdit, 'username')
        password = self.findChild(QLineEdit, 'password')
        login = self.findChild(QPushButton, 'login')
        login.clicked.connect(self.clicked_login)

    def clicked_login(self):
        # get data from user
        txtusername = self.username.text()
        txtpass = self.password.text()

        # get data from userdata.json file
        userdata = jsondata()
        info = userdata.getdata()

        if txtusername == info['username'] and txtpass == info['pass']:
            self.dashboard = Dashboard()
            self.dashboard.location_on_the_screen()
            self.dashboard.show()
            self.close()
        else:
            QMessageBox.about(self, "Error",
                              "Username or password is incorrect.")

    def location_on_the_screen(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())
Exemple #4
0
 def POST(self):
     input = web.input()
     print input
     dashboard = Dashboard()
     dashboard.add_server(input.hostname, input.ip, input.user,
                          input.password, input.os, input.desc)
     raise web.seeother('/dashboard?username={0}&fullname={1}'.format(
         session.username, session.fullname))
    def __init__(self, parent=None):
        super().__init__(parent)
        self.dashboard = Dashboard()
        self.createUi()

        self.dashboardUpdateTimer = QTimer(self)
        self.dashboardUpdateTimer.setInterval(5)
        self.dashboardUpdateTimer.timeout.connect(self.updateDashboard)
Exemple #6
0
 def GET(self):
     input = web.input()
     if session.logged_in:
         dashboard = Dashboard()
         dashboard.checkin_server(input.username, input.id, input.hostname,
                                  input.os)
         raise web.seeother('/dashboard?username={0}&fullname={1}'.format(
             session.username, session.fullname))
     else:
         raise web.seeother('/loginFailed')
Exemple #7
0
def run():
    # set initial time
    start_time = time.time()

    # dump hyper parameters settings
    print(time.strftime('%Y-%m-%d %H:%M:%S') + ' Hyper-parameters setting')
    # get configuration
    args = config.get()

    # check for save_sample_image model
    save_best_model = ModelCheckpoint(
        filepath=args.model_file_train, verbose=1,
        save_best_only=True)  # , save_best_only=True

    if os.path.isfile(args.model_file_train):
        print(time.strftime('%Y-%m-%d %H:%M:%S') + ' Load model from file...')
        skip_gram_model = load_model(args.model_file_train)
    else:
        # get embedding model
        print(time.strftime('%Y-%m-%d %H:%M:%S') + ' Build model...')
        skip_gram_model = model.get(args)

    # dashboard
    watch_board = Dashboard(folder=config.FOLDER,
                            dump_file="dashboard.dump",
                            statistic_file="statistic.txt",
                            model=skip_gram_model,
                            show_board=True)

    # begin training
    print(time.strftime('%Y-%m-%d %H:%M:%S') + " Begin training..")
    # Train the model each generation and show predictions against the
    # validation dataset
    for iteration in range(1, args.iterations):
        print(
            time.strftime('%Y-%m-%d %H:%M:%S') + ' Iteration %d ' % iteration)
        skip_gram_model.fit_generator(
            zhwiki_corpus.skip_gram_generator(batch_size=args.batch_size,
                                              context_window_size=5,
                                              negative_samples=10),
            steps_per_epoch=args.steps_per_epoch,
            epochs=args.epochs,
            callbacks=[save_best_model, watch_board],
            # callbacks=[save_best_model],
            validation_data=zhwiki_corpus.skip_gram_generator(
                batch_size=args.batch_size,
                context_window_size=5,
                negative_samples=10),
            validation_steps=100,
            verbose=0)

    # close_board windows
    watch_board.close_board()
    print("task took %.3fs" % (float(time.time()) - start_time))
Exemple #8
0
 def initialize_threads(self):
     """ Initializes io threads"""
     super().initialize_threads()
     self.dashboard_interval = int(self.ping_interval * 2)
     self.topic_fastclock_pub = self.publish_topics[Global.FASTCLOCK]
     self.topic_dashboard_pub = self.publish_topics[Global.DASHBOARD]
     self.topic_node_pub = self.publish_topics[Global.NODE]
     self.topic_ping_sub = self.subscribed_topics[Global.PING]
     # print("!!! ping sub: "+self.topic_ping_sub)
     self.topic_sensor_sub = self.subscribed_topics[Global.SENSOR]
     self.topic_backup_sub = self.subscribed_topics[Global.BACKUP]
     # print("!!! backup sub: "+self.topic_backup_sub)
     if Global.CONFIG in self.config:
         if Global.OPTIONS in self.config[Global.CONFIG]:
             if Global.TIME in self.config[Global.CONFIG][Global.OPTIONS]:
                 if Global.FAST in self.config[Global.CONFIG][
                         Global.OPTIONS][Global.TIME]:
                     if Global.RATIO in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_ratio = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.RATIO])
                     if Global.INTERVAL in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_interval = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.INTERVAL])
             if Global.PING in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.ping_interval = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.PING]
             if Global.BACKUP in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.backup_path = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.BACKUP]
     self.roster = Roster(self.log_queue,
                          file_path=Global.DATA + "/" + Global.ROSTER +
                          ".json")
     self.switches = Switches(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.SWITCHES + ".json")
     self.warrants = Warrants(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.WARRANTS + ".json")
     self.signals = Signals(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SIGNALS +
                            ".json")
     self.layout = Layout(self.log_queue,
                          file_path=Global.DATA + "/" + Global.LAYOUT +
                          ".json")
     self.dashboard = Dashboard(self.log_queue,
                                file_path=Global.DATA + "/" +
                                Global.DASHBOARD + ".json")
     self.sensors = Sensors(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SENSORS +
                            ".json")
Exemple #9
0
class Settings(QWidget):
    def __init__(self):
        super().__init__()
        uic.loadUi("ui/setting.ui", self)

        # finding chields
        self.setpath = self.findChild(QLineEdit, 'databasepath')
        setpathbtn = self.findChild(QPushButton, 'newpathbtn')
        self.existingpath = self.findChild(QLineEdit, 'existingpath')
        findpathbtn = self.findChild(QPushButton, 'existingpathbtn')
        savesettings = self.findChild(QPushButton, 'save')

        # set signal for this btn
        setpathbtn.clicked.connect(self.setdatabasepath)
        findpathbtn.clicked.connect(self.findexistingpath)
        savesettings.clicked.connect(self.savesettings_func)

    def location_on_the_screen(self):
        qr = self.frameGeometry()
        cp = QDesktopWidget().availableGeometry().center()
        qr.moveCenter(cp)
        self.move(qr.topLeft())

    def setdatabasepath(self):
        folderpath = QFileDialog.getExistingDirectory()
        self.setpath.setText(folderpath)

    def findexistingpath(self):
        folderpath = QFileDialog.getExistingDirectory()
        self.existingpath.setText(folderpath)

    def savesettings_func(self):
        if self.existingpath.text() == '':
            path = self.setpath.text()
            userdata = jsondata()
            userdata.setdatapath(path + '/pdm_database')
            # creating pdm_database folder according to given path
            dirpath = os.path.join(path, 'pdm_database')
            os.mkdir(dirpath)
            dirpath = os.path.join(dirpath, 'images')
            os.mkdir(dirpath)
            # open dashboard
            self.dashboard = Dashboard()
            self.dashboard.location_on_the_screen()
            self.dashboard.show()
            self.close()
        elif self.setpath.text() == '':
            path = self.existingpath.text()
            userdata = jsondata()
            userdata.setdatapath(path)
            self.close()
        elif self.existingpath.text() != '' and self.setpath.text() != '':
            QMessageBox.about(self, "Error",
                              "You must provide only one of them.")
Exemple #10
0
    def __init__(self):
        """
		Sets up the initial conditions of the game
		:param width: Screen width
		:param height: Screen height
		"""
        super().__init__()
        self.background = arcade.load_texture("images/space1.png")
        self._keys = set()
        self.score = 0
        self.lives = PLAYER_LIVES

        self.delay = START_DELAY

        self.window.set_mouse_visible(False)
        #Objects
        self.dashboard = Dashboard()
        self.ship = Ship()

        # bullet Sprites
        self.bullets = SpriteList()
        # how many bullets you're allowed to make
        self.ammo = 5

        self.meteors = SpriteList()
        self.animations = SpriteList()
        self.lifeList = SpriteList()

        #Explosion Frames
        self.explosion_texture_list = createExplosionTextureList()
        self.animationsLoaded = False
        self.load_animantion_frames()

        # Load sounds. Sounds from kenney.nl
        self.gun_sound = arcade.sound.load_sound(
            ":resources:sounds/laser2.wav")
        self.hit_sound = arcade.sound.load_sound(
            ":resources:sounds/explosion2.wav")

        arcade.set_background_color(arcade.color.ARSENIC)

        #This is for the lives
        start_x = 20
        x = 0
        start_y = SCREEN_HEIGHT - 125
        for life in range(self.lives):
            heart = Sprite('images/heart.png')
            heart.scale = 0.1
            x = start_x + (life * (heart.width / 2) + 10)
            heart.center_x = x
            heart.center_y = start_y

            self.lifeList.append(heart)
Exemple #11
0
def dashboard_startup(cfg):
    # Create dashboard
    dashbrd = Dashboard(cfg["name"], cfg["init-param"])
    dashboardPool.append(dashbrd)

    # Create dashboard
    #
    name = html_generate_dashboard_page(cfg["name"])
    if name:
        dashbrd.setHtmlDashboard(name)

    # Find and load recent incomplete builds in DB and update dashboard
    #
    bldDB.retrieve_incomplete_builds(cfg["name"])

    # Find and load last successful build in DB if not exist 
    if dashbrd.getLastSuccessfulBuild() == 0:
        bldNum = bldDB.find_prev_build(cfg["name"], "lastSuccessfulBuild")
        if bldNum != 0:
            dashbrd.setLastSuccessfulBuild(bldNum)

    # Find and load last build that passed validation in DB

    dashbrd.start()

    return dashbrd
Exemple #12
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setGeometry(525, 225, 1080, 720)
        title = 'MedRec'
        self.setWindowTitle(title)
        self.conn = sqlite3.connect(path + '/databases/medi_colab.db')

        #initialize and set a central widget
        self.central_widget = QStackedWidget()
        self.setCentralWidget(self.central_widget)

        #initialize empty common names list
        self.common_names = []

        #initialize empty scientific names list
        self.scientific_names = []

        if self.checkInternetConn:
            #fetch token from offline database
            token = self.retrieve_token()
            if self.verify_token(token):
                dashboard_widget = Dashboard(self)
                #log in to dashboard
                dashboard = Dashboard(self)
                self.central_widget.addWidget(dashboard)
                self.central_widget.setCurrentWidget(dashboard)

                #define methods to access on clicking buttons
                dashboard.makeRecordEntryButton.clicked.connect(
                    self.chooseCase)
                dashboard.viewProfileButton.clicked.connect(self.viewProfile)
                dashboard.registerPatientButton.clicked.connect(
                    self.register_patient)
                dashboard.viewPatientRecordButton.clicked.connect(
                    self.viewRecord)

            else:
                global start_widget
                #initialize a login widget
                start_widget = Login(self)
                start_widget.loginButton.clicked.connect(self.login)

        else:
            start_widget = Register(self)
            start_widget.registerButton.clicked.connect(self.register)

        #make it initial widget
        self.central_widget.addWidget(start_widget)
        self.central_widget.setCurrentWidget(start_widget)
Exemple #13
0
class Game:

    settings: Settings

    def __init__(self):
        pygame.init()
        self.settings = Settings()
        self.settings.reset()
        self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
        self.intro = Intro(self.screen, self.settings)
        self.menu = Menu(self.screen, self.settings)
        pygame.display.set_caption("Pacman Portal")

        self.maze = Maze(self.screen, mazefile='pacmap.txt')

        self.pacman = Pacman(self.screen)

        self.dashboard = Dashboard(self.screen)

        self.portal_enter = Portal("Enter", self.screen, self.settings)
        self.portal_exit = Portal("Exit", self.screen, self.settings)

        scoresheet = open('scoresheet.txt', 'r')
        self.settings.score_high = int(scoresheet.read())

    def __str__(self): return 'Game(Pacman Portal), maze=' + str(self.maze) + ')'

    def play(self):
        eloop = EventLoop(finished=False)
        while not eloop.finished:
            eloop.check_events(self.pacman, self.menu, self.portal_enter, self.portal_exit, self.settings)
            self.update_screen()

    def update_screen(self):
        self.screen.fill((0, 0, 0))
        if self.settings.mode == "Game":
            self.maze.check_pac_conditions(self.pacman, self.settings, self.portal_enter, self.portal_exit)
            self.maze.blitme(self.settings)
            self.pacman.blitme(self.settings)
            self.dashboard.blitme(self.settings)
            self.portal_enter.blitme()
            self.portal_exit.blitme()
        elif self.settings.mode == "Menu":
            self.menu.blitme()
            pass
        elif self.settings.mode == "Intro":
            self.intro.blitme()
        pygame.display.flip()
Exemple #14
0
async def main(argv):
    user = ''
    password = ''
    try:
        opts, args = getopt.getopt(argv, "hu:p:", ["user="******"password="******"-u", "--user"):
            user = arg
        elif opt in ("-p", "--password"):
            password = arg

    if (user == '' or password == ''):
        printHelp()
        sys.exit()

    account = AudiConnectAccount(user, password)
    await account.update()

    for vehicle in account.vehicles:

        dashboard = Dashboard(vehicle)
        for instrument in dashboard.instruments:
            print(str(instrument), instrument.str_state)
Exemple #15
0
    def __init__(self, model, noise_H=AR1(), noise_K=AR1(), dashboard=False):
        '''
        Gibbs sampler class (object):
        - params : dic of parameters with initial values
        - data : data used in simulation
        - laws : dic (same keys as params) -> functions for simulating param knowing the others
            ex: laws[key] = f where:
                
                def f(params, data):
                    ....
                    return np.random.?(???)
        To run Gibbs sampler, use method: Gibbs_object.run()
        To get history (simulated parameters), use Gibbs_object.get_history(key)
        '''
        self.model = model
        self.history = {}  # keep record of simulated parameters
        self.T_check = []

        self.x_ord = OrdinalScale()
        self.y_sc = LinearScale()
        self.x_data = np.array([])
        self.noise_H = noise_H
        self.noise_K = noise_K
        for key in model.params.keys():
            self.history[key] = []
        if dashboard:
            self.dashboard = Dashboard(self.model)
        else:
            self.dashboard = None
Exemple #16
0
    def dashboard(self, name, options={}):
        if not options.get('width'): options['width'] = self.width
        if not options.get('height'): options['height'] = self.height
        if not options.get('from'): options['from'] = self.time_from
        if not options.get('until'): options['until'] = self.until

        return Dashboard(name, self.graph_templates, self.name, options,
                         self.graphite_render)
Exemple #17
0
 def openlogin(self):
     self.window = QtWidgets.QMainWindow()
     self.ui = Dashboard()
     self.ui.setupUi(self.window)
     
     self.window.hide()
     ui.setupUi(Form)
     Form.show()
Exemple #18
0
    def clicked_login(self):
        # get data from user
        txtusername = self.username.text()
        txtpass = self.password.text()

        # get data from userdata.json file
        userdata = jsondata()
        info = userdata.getdata()

        if txtusername == info['username'] and txtpass == info['pass']:
            self.dashboard = Dashboard()
            self.dashboard.location_on_the_screen()
            self.dashboard.show()
            self.close()
        else:
            QMessageBox.about(self, "Error",
                              "Username or password is incorrect.")
Exemple #19
0
    def level_up(self):
        self.level += 1
        self.state = const.PLAYING
        self.dashboard = Dashboard(self.surface) # reset dash
        self.ship = Ship(self.surface, LEVEL_DATA[self.level]['start_fire']) # reset ship
        self.active_text_box = None # clear text box

        self.last_f_tick = time.time()
        self.last_s_tick = time.time() - 0.5 # offset so they don't happen simultaneously

        self.lightyears_left = 9
        self.last_lightyear_tick = time.time()

        self.is_paused = False
        self.time_paused = None

        self.begin_level()
Exemple #20
0
 def __init__(self) -> None:
     self.bridge = CvBridge()
     self.sensors = Sensor(PUBLISHER_MSGS, SUBSCRIBER_MSGS)
     pygame.init()
     self.window = pygame.display.set_mode((WIDTH, HEIGHT))
     self.window.fill(WHITE)
     self.dash = Dashboard(WIDTH, DASH_HEIGHT, self.sensors)
     self.keys_pressed = pygame.key.get_pressed()
Exemple #21
0
    def __init__(self, controller=None):
        Service.__init__(self, 'dispatcher')

        self.handlers[Message.TYPE_LOGIN] = self.handle_login
        self.handlers[Message.TYPE_IMAGE] = self.handle_image
        self.handlers[Message.TYPE_RESULT] = self.handle_result

        self.server = Server(self, cfg.SERVER_PORT)
        self.protocols = {}

        self.nodes = {}

        if cfg.DASHBOARD:
            self.dashboard = Dashboard()
            self.dashboard.start()

        else:
            self.dashboard = None

        measure_period = float(cfg.CONTROLLER_LOOP_TIME)/cfg.MEASURES_PER_LOOP
        self.monitor = Monitor(self.process_measurements, measure_period)
        self.monitor.register_item(self.ITEM_FPS, Monitor.ITEM_RATE)
        self.monitor.register_item(self.ITEM_MAKESPAN, Monitor.ITEM_AVG)
        self.monitor.register_item(self.ITEM_THROUGHPUT, Monitor.ITEM_RATE)

        self.controller = controller
        self.controller.dashboard = self.dashboard
        self.controller.dispatcher = self

        if self.dashboard:
            self.dashboard.controller = controller

        self.imagebuf = Queue.Queue()   # Buffer of encoded images
                                        # (time stamp, image data)

        # Initialize probe to blank image
        self.probe_image = self.generate_probe_image()

        self.tokens = Queue.Queue()
        self.job_id = 0

        self.job_image_cache = {}

        self.sub_loop = 0
        return
Exemple #22
0
 def openwindow(self):
     self.window = QtWidgets.QMainWindow()
     self.ui = Dashboard()
     self.ui.setupUi(self.window)
     Form.hide()
     self.window.show()
     self.ui.btn_logout.clicked.connect(self.logout)
     self.ui.btn_add.clicked.connect(self.ui.registerUser)
     self.ui.btn_settings.clicked.connect(self.settings)
Exemple #23
0
 def get_details(self):
     username = self.username.get()
     password = self.password.get()
     print(username, password)
     #just a dummy case, insert a db query method to validate the user in the below space
     user = is_user_valid(username, password)
     user1 = is_doc_valid(username)
     if user is None and user1 is None:
         #here comes the db query
         self.confirmation_label.config(text='Invalid Username or password',
                                        fg='red')
     else:
         if user is None:
             self.root.destroy()
             Dashboard(user1)
         else:
             self.root.destroy()
             Dashboard(user)
Exemple #24
0
def before_all(context):
    context.browser = webdriver.Chrome("..\\Drivers\\chromedriver")
    context.cp = ComicPage(context.browser)
    context.dash = Dashboard(context.browser)
    j = jsonParser()
    settings = j.readJSON(path="../../lineniumSettings.json")
    context.url = settings["comicURL"]
    context.noCommentURL = settings["noCommentURL"]
    context.commentsURL = settings["commentsURL"]
Exemple #25
0
    def __init__(self, num_threads, seeds, cont_to_crawl):
        self.num_workers = num_threads
        self.dash = Dashboard(num_threads)
        self.workers = []
        self.frontier = Frontier(num_threads, self.dash)
        self.db = Storage()

        # Create the workers
        for i in range(num_threads):
            self.workers.append(CrawlerThread(i, 'CrawlerThread' + str(i), self.frontier, self.dash))
        # print("Workers created")
        # insert seeds in to serve
        if not cont_to_crawl:
            self.frontier.push_to_serve(seeds, 0)
            # print("seeds pushed")
            self.frontier.distribute()
            # print("seeds distributed")
        else:
            self.frontier.load_to_crawl()
Exemple #26
0
def main():
    """This function is the main function to be executed to play the game."""

    pygame.init()

    # we build the labyrinth, with the player and the tools to be found
    csv_path = os.path.join("data", "grid.csv")
    game_laby = Labyrinth(LabyViewer.LABY_WIDTH, LabyViewer.LABY_HEIGHT,
                          csv_path)
    game_laby.initialize_player_location()
    game_player = game_laby.player
    game_tools = game_laby.tools

    # we initialize the main window with our game interface
    window = pygame.display.set_mode(
        (Interface.SCREEN_WIDTH, Interface.SCREEN_HEIGHT))
    game_back = pygame.image.load("sprites\\backs\\blue_sky.png").convert()
    game_labyviewer = LabyViewer(game_laby)
    game_dashboard = Dashboard("game")
    game_interface = Interface(game_back, game_labyviewer, game_dashboard)
    window.blit(game_back, Interface.SCREEN_ORIGIN)

    # we load our sprites
    m_gyver = pygame.image.load("sprites\\laby\\m_gyver.png").convert()
    m_gyver.set_colorkey((255, 255, 255))  # set white as transparent
    sand_path = pygame.image.load("sprites\\laby\\path.png").convert()
    wall = pygame.image.load("sprites\\laby\\wall.png").convert()
    guard = pygame.image.load("sprites\\laby\\guard.png").convert()
    guard.set_colorkey((255, 255, 255))  # set white as transparent

    # we improve our window
    mac_g_a = pygame.image.load("sprites\\laby\\m_gyver.png").convert_alpha()
    mac_g_a.set_colorkey((255, 255, 255))  # set white as transparent
    pygame.display.set_icon(mac_g_a)
    pygame.display.set_caption("Mac Gyverinth - game mode - by etienne86")
    pygame.display.flip()

    # we display our labyrinth with walls, paths, guard and player
    sprites_dict = {
        "wall": wall,
        "sand_path": sand_path,
        "guard": guard,
        "m_gyver": m_gyver
    }
    game_labyviewer.display_labyrinth(window, sprites_dict)
    # we display our tools in the labyrinth
    game_labyviewer.display_tools_in_labyrinth(window)
    # we display our dashboard
    game_interface.display_dashboard(window, game_tools)

    # we execute our game loop
    game_loop(window, game_interface, game_laby, game_player, sprites_dict)

    pygame.quit()
Exemple #27
0
    def __init__(self):
        pygame.init()
        self.settings = Settings()
        self.settings.reset()
        self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
        self.intro = Intro(self.screen, self.settings)
        self.menu = Menu(self.screen, self.settings)
        pygame.display.set_caption("Pacman Portal")

        self.maze = Maze(self.screen, mazefile='pacmap.txt')

        self.pacman = Pacman(self.screen)

        self.dashboard = Dashboard(self.screen)

        self.portal_enter = Portal("Enter", self.screen, self.settings)
        self.portal_exit = Portal("Exit", self.screen, self.settings)

        scoresheet = open('scoresheet.txt', 'r')
        self.settings.score_high = int(scoresheet.read())
Exemple #28
0
 def Login(self):
     username = self.txt_username.text()
     password = self.txt_pwd.text()
     if username == "" and password == "":
         QMessageBox.about(
             self, 'Error',
             'Provide a Valid username and password to continue')
     else:
         cursor = connection.cursor()
         sql = "Select * from users where username=%s and pwd=%s"
         cursor.execute(sql, (username, password))
         result = cursor.fetchall()
         if int(len(result)) <= 0:
             QMessageBox.about(
                 self, "Error", "Invalid username and password. "
                 "Provide a valid username and password to continue ")
         else:
             self.__dashboard__ = Dashboard()
             self.__dashboard__.show()
             self.close()
Exemple #29
0
def start_game():
    pygame.init()
    settings = Settings()
    screen = pygame.display.set_mode(
        (settings.screen_width, settings.screen_height))
    pygame.display.set_caption("Miner by Cristhianxy")
    game_stats = GameStats(settings)

    menu_items = Group()
    title_top = Menu_Item("MINER", 70, screen, 50)
    btn_start = Menu_Item("Start", 30, screen, 135, "start")
    btn_hs = Menu_Item("High Score", 30, screen, 175, "high_score")
    btn_exit = Menu_Item("EXIT", 30, screen, 215, "exit")
    sub_title_1 = Menu_Item("Code by Cristhian Ferreira", 15, screen, 345)
    sub_title_2 = Menu_Item("Created with Pygame and Love", 15, screen, 380)

    menu_items.add(title_top, btn_start, btn_hs, btn_start, btn_exit,
                   sub_title_1, sub_title_2)

    player = Player(settings, screen)
    bullets = Group()
    ground_grid = Group()
    jewels = Group()
    gf.create_ground(settings, screen, player, ground_grid)
    brian = Monster(settings, screen, 406.6, 506.3)
    brian2 = Monster(settings, screen, 500, 403)
    brian3 = Monster(settings, screen, 744, 502)
    brian4 = Monster(settings, screen, 755, 323)
    monsters = Group()
    monsters.add(brian, brian2, brian3, brian4)
    gf.create_jewels(screen, settings, jewels)
    game_stats.reset_game()
    dashboard = Dashboard(screen, settings, game_stats)
    key_pressed = ""
    """MAIN LOOP"""
    while True:

        if not game_stats.game_status:
            gf.menu_init(menu_items)

        gf.event_listener(screen, settings, player, bullets, menu_items,
                          game_stats)

        if game_stats.game_status:

            player.update()
            brian.move_y()
            brian2.move_x()
            brian3.move_y()
            brian4.move_x()
            gf.update_bullets(settings, screen, bullets)
            gf.update_screen(settings, screen, player, bullets, ground_grid,
                             monsters, jewels, dashboard, game_stats,
                             dashboard)
    def tabsClicked(self, event, source_object=None):
        print("Clicked, from: ", source_object[0].objectName())

        tab = source_object[0].objectName()

        if tab == "Dashboard":
            # self.window.emit(1)
            source_object[1].hide()
            view = Dashboard(source_object[1])
        elif tab == "Employees":
            # self.window.emit(2)
            source_object[1].hide()
            view = Employee(source_object[1])

        elif tab == "Users":
            source_object[1].hide()
            view = Users(source_object[1])
        elif tab == "Tables":
            # self.window.emit(3)
            source_object[1].hide()
            view = Table(source_object[1])
        elif tab == "Reservations":
            # self.window.emit(4)
            source_object[1].hide()
            view = Reservations(source_object[1])
        elif tab == "Category":
            # self.window.emit(5)
            source_object[1].hide()
            view = Category(source_object[1])
        elif tab == "Menu":
            # self.window.emit(8)
            source_object[1].hide()
            view = Menu(source_object[1])
        elif tab == "Orders":
            # self.window.emit(7)
            source_object[1].hide()
            view = Orders(source_object[1])
        elif tab == "Bill":
            # self.window.emit(9)
            source_object[1].hide()
            view = Bill(source_object[1])
        elif tab == "Settings":
            # self.window.emit(6)
            source_object[1].hide()
            view = Settings(source_object[1])
        elif tab == "Logout":
            query = "update admin set logged_in='no' where logged_in='yes'"
            values = ()

            data = self.db.execute(query, values)

            source_object[1].hide()
            view = Logout(source_object[1])
Exemple #31
0
    def GET(self):
        input = web.input()
        if session.logged_in:
            dashboard = Dashboard()
            dashboard.servers(input.username)

            fields = ['os']
            aggregation = {
                'aggr_fun': 'COUNT',
                'aggr_field': 'id',
                'alias': 'osCount',
                'groupby': 'os'
            }

            user_data = dashboard.server_distribution(input.username,
                                                      aggregation=aggregation,
                                                      fields=fields)

            aggregation['alias'] = 'serverCount'

            all_data = dashboard.server_distribution('NULL',
                                                     aggregation=aggregation,
                                                     fields=fields)

            return render.dashboard(input.username, input.fullname, user_data,
                                    all_data)
        else:
            raise web.seeother('/loginFailed')
Exemple #32
0
    def post(self, request):
        #Create new canvas
        username = request.POST['username']
        color_id = request.POST['color_id']
        dashboard_id = request.POST.get('dashboard_id', None)
        if not dashboard_id:
            dashboard = Dashboard(username)
            dashboard_id = dashboard.dashboard_id
        else:
            dashboard = get_dashboard(dashboard_id)
            if dashboard:
            	dashboard_id = dashboard.dashboard_id
            else:
            	dashboard = Dashboard(username)
                dashboard_id = dashboard.dashboard_id
        dashboard.add_buddy(Buddy(username, color_id))
        dashboard.save()

        request.session["color_id"] = color_id
        return redirect(dashboard.get_absolute_url())
Exemple #33
0
    def post(self, request):
        # Create new canvas
        username = request.POST["username"]
        color_id = request.POST["color_id"]
        dashboard_id = request.POST.get("dashboard_id", None)
        if not dashboard_id:
            dashboard = Dashboard(username)
            dashboard_id = dashboard.dashboard_id
        else:
            dashboard = get_dashboard(dashboard_id)
            if dashboard:
                dashboard_id = dashboard.dashboard_id
            else:
                dashboard = Dashboard(username)
                dashboard_id = dashboard.dashboard_id
        dashboard.add_buddy(Buddy(username, color_id))
        dashboard.save()

        request.session["color_id"] = color_id
        # Notify all clients of new user
        return redirect(dashboard.get_absolute_url())
def dashboard():
    board = Dashboard(widgets)
    board.configure(user_profile(1))
    return render_template('dashboard.html', dashboard = board)
Exemple #35
0
        if timerangetype == "month":
            sdate = raw_input("please enter start month in YYYY-MM-DD format: ")
            edate = raw_input("please enter end month in YYYY-MM-DD format: ")
        if timerangetype == "year":
            sdate = raw_input("please enter start month in YYYY-MM-DD format: ")
            edate = raw_input("please enter end month in YYYY-MM-DD format: ")

        self.timerange = (timerangetype,sdate,edate)

    def getparams(self):
        print "please enter the dimensions you want.You have the following options: "
        for item in self.mart.dimensions.keys():
            print item
        self.params = self.mart.dimensions.keys()

#mygreeter = greeter()
#unique_id,mart,metric,aggregation,timeseries,timerange,params = mygreeter.main()
unique_id,mart,metric,aggregation,timeseries,timerange,params = 'Abhishek','flight_paymentdetails','Gross Margin','SUM','bookingdate',('date','2012-05-14','2012-05-14'),['airline','source','destination','sector','city','status','bookingflag','typeoftravel']
mydashboard = Dashboard(unique_id,mart,metric,aggregation,timeseries,timerange,params)
def ask():
    choice = raw_input("Press 0 to continue and 1 to exit : ")
    if choice == '1' :
        mydashboard.exit()
    else : 
        mydashboard.interact()
        ask()
mydashboard.process()
mydashboard.render()
ask()