def generate(self):
     if self.ids.input.text == '':
         self.showHelp()
     else:
         sm.transition = RiseInTransition()
         sm.current = 'display'
         self.start()
Пример #2
0
 def build(self):
     self.title = '(^_^)'
     self.icon = 'data/icon.png'
     screen_manager = ScreenManager(transition=RiseInTransition())
     screen_manager.add_widget(LoginScreen())
     screen_manager.add_widget(DisplayScreen())
     return screen_manager
Пример #3
0
    def __init__(self, **kwargs):
        super(PostScreenManager, self).__init__(**kwargs)
        self.transition = RiseInTransition()

        # get the post wall and post carousel references
        wall = self.ids['pw']
        carousel = self.ids['pc']

        # pass the refernece to the screen manager
        wall.screen_manager = self
        carousel.screen_manager = self
        # generate new data
        data = post_generator.generate_new_data()
        self.number_of_posts = len(data)
        # pass the data tot he post wall
        wall.data = data
        # feed the carousel with the data
        for item in data:
            if 'ImagePost' in item['viewclass']:
                carousel.add_widget(Image(source=item['image_path']))
            elif 'TextPost' in item['viewclass']:
                carousel.add_widget(Label(text=item['label_text']))

        self._keyboard = Window.request_keyboard(self._keyboard_closed, self)
        if not self._keyboard:
            return
        self._keyboard.bind(on_key_down=self.on_keyboard_down)

        self.movement_flag = False
        #self.current_active_post_index = None
        Clock.schedule_once(wall.center_first_post, 1)
Пример #4
0
    def __init__(self, **kwargs):
        super(RootWidget, self).__init__(**kwargs)
        self.transition = RiseInTransition()
        self.error_message = ''
        self.previous_screens = []

        self.add_widget(StartAppModalScreen())
        self.current = StartAppModalScreen.NAME
        self.current_screen.data = dict(start_app_callback=self.start_app)
Пример #5
0
 def on_touch_up(self, touch):
     if touch.grab_current is self:
         touch.ungrab(self)
         self.ripple_fade()
         self.root.ids.profilePage.reg_no = self.parent.ids.lbl1.text
         self.root.transition = RiseInTransition()
         self.root.current = "profilepage"
         return True
     return False
Пример #6
0
 def open(self, view):
     self.ensure_unique_name(view)
     self.unfocus_maybe()
     name = view.name
     if self.has_screen(name):
         self.remove_widget(self.get_screen(name))
     self.add_widget(view)
     self.transition = RiseInTransition()
     self.current = name
     self.history.append(view)
Пример #7
0
 def trocar(self,
            nome_tela,
            tipo_transicao='Slide',
            sentido_da_imagem='up'):
     if (tipo_transicao == 'Slide'):
         self.manager.transition = FadeTransition()
     else:
         self.manager.transition = RiseInTransition()
     self.manager.transition.direction = sentido_da_imagem
     self.manager.current = nome_tela
Пример #8
0
    def build(self):
        languages_yaml = strictyaml.load(
            Path("lang_template.yaml").bytes().decode('utf8')).data
        self._languages = {k: dict(v) for k, v in languages_yaml.items()}
        self._selected_language = next(iter(self._languages))  # get a language

        self._m = Manager(self._config, transition=RiseInTransition())
        self._config.PRICEFEED.start()
        self._config.STATUS.start()
        return self._m
Пример #9
0
    def first_start(self, *_):

        self.root.ids.sm.transition = FallOutTransition() \
            if self.theme_cls.theme_style == 'Dark' else RiseInTransition()

        self.set_decorations()
        self.root.ids.sm.current = 'scr 1'

        self.root.ids.sm.transition = SlideTransition()
        self.root.ids.sm.transition.direction = 'up'
Пример #10
0
    def asigna_sectores(self, sectores=()):
        from pickle import loads
        Logger.debug("%s: asigna_sectores %s" % (APP, sectores))

        n_sectores = self.horario.n_sectores()
        for i in range(0, n_sectores):
            s = "s%d" % (i + 1)
            if self.restarting:
                self.horario.actualiza_sector(s, self.config.get('general', s))
            else:
                self.horario.actualiza_sector(s, sectores[i])
                self.config.set('general', s, sectores[i])

        if self.restarting:
            # Pickle parece que tiene un bug con la lista al guardar
            # en el archivo. Utilizamos la codifiación en base64 para evitarlo
            string = self.config.get('general', 'alarmas')
            # Logger.debug("%s: String %s" % (APP, str(string)))
            self.alarmas = loads(b64decode(string))
        else:
            self.alarmas = self.calculate_alarms()
            self.config.set('general', 'alarmas',
                            b64encode(dumps(self.alarmas)))
        Logger.debug("%s: alarmas: %s" % (APP, pformat(self.alarmas)))

        # Necesitamos un copy para que los observadores reaccionen
        self.horario = copy(self.horario)

        if not self.planilla:
            self.planilla = PlanillaScreen()
            self.scmgr.add_widget(self.planilla)
            self.planilla.pw.bind(on_touch_down=self.show_image)

        if not self.imagescreen:
            self.imagescreen = ImageScreen()
            self.imagescreen.app = self
            self.scmgr.add_widget(self.imagescreen)

        self.imagescreen.load("data/%s.png" % self.horario.planilla)

        self.scmgr.transition = RiseInTransition()
        self.scmgr.current = 'planilla'

        Logger.debug("%s: current 'planilla' - RiseIn" % APP)
        self.config.set('general', 'numero', self.numero)
        self.config.set('general', 'planilla', self.horario.planilla)
        self.config.set('general', 'final',
                        self.horario.final.strftime("%d/%m/%y %H:%M"))
        self.config.write()

        self.arrancar_servicio()
Пример #11
0
    def handleRequest(self, data):
        self.get_screen("aio").reset()
        if data[0] == "info":
            if len(data) > 1:
                self.get_screen("aio").set_color(data[1])
            if len(data) > 2:
                self.get_screen("aio").set_text(data[2])
            if len(data) > 3:
                self.get_screen("aio").set_title(data[3])
            if len(data) > 4:
                self.get_screen("aio").set_image(data[4])
            if len(data) > 5:
                try:
                    time = int(data[5])
                    Clock.schedule_once(self.startIt, time)
                except:
                    pass

            prevTransition = self.transition
            self.transition = RiseInTransition()
            self.current = "aio"
            self.transition = prevTransition

        if data[0] == "image":
            if len(data) > 1:
                self.get_screen("aio").set_image(data[1])
            if len(data) > 2:
                self.get_screen("aio").set_color(data[2])
            if len(data) > 3:
                try:
                    time = int(data[3])
                    Clock.schedule_once(self.startIt, time)
                except:
                    pass
            prevTransition = self.transition
            self.transition = RiseInTransition()
            self.current = "aio"
            self.transition = prevTransition
Пример #12
0
    def build(self):
        self.title = 'Gépjármű-nyilvántartás'
        formScreen = FormScreen(name="Form")
        sm.add_widget(formScreen)

        listaScreen = ListaScreen(name="Lista")
        sm.add_widget(listaScreen)

        infoScreen = InfoScreen(name="Info")
        sm.add_widget(infoScreen)

        sm.transition = RiseInTransition()
        sm.current = "Form"
        return sm
Пример #13
0
class CamApp(MDApp):
    ######## Global Variables ########
    username = None
    screen_manager = ScreenManager(transition=RiseInTransition())

    # Add the screens to the manager and then supply a name
    # that is used to switch screens
    def build(self):
        CamApp.screen_manager.add_widget(HomeScreen(name="HomeScreen"))
        CamApp.screen_manager.add_widget(LoginScreen(name="LogMeIn"))
        CamApp.screen_manager.add_widget(UserHome(name="UserHomePage"))
        # self.capture = None
        # self.my_camera = LoginScreen(capture=self.capture, fps=30)
        return CamApp.screen_manager
Пример #14
0
def change_screen(name):
    global CURRENT_SCREEN
    previous = index_of_screen(sm.current)
    new = index_of_screen(name)
    if name == "end":
        sm.transition = RiseInTransition()
    else:
        sm.transition = SlideTransition()
    direction = (new - previous) % len(SCREEN_LIST)
    if direction == 1:
        sm.transition.direction = "left"
    else:
        sm.transition.direction = "right"
    sm.current = name
    CURRENT_SCREEN = new
Пример #15
0
    def btnLogin(self):
        user = self.nameField.text
        password = self.passwField.text

        ## Check username and password for correctness
        ## if good...
        if (userDatabase.credentialCheck(user, password)):
            manageWin.transition = RiseInTransition()
            manageWin.transition.duration = 0.15
            manageWin.current = "mainWin"
            MainWindow.currentUsername = user
            self.reset()  ## clear the form
        ## if bad
        else:
            invalidLogin()
Пример #16
0
    def build(self):
        # Sets the window/application title.
        self.title = APP_NAME
        self.icon = 'es_gui/resources/logo/Quest_App_Icon_256.png'

        # Create ScreenManager.
        sm = QuEStScreenManager(transition=RiseInTransition(duration=0.2, clearcolor=[1, 1, 1, 1]))
        #sm = QuEStScreenManager(transition=SwapTransition(duration=0.2))

        # Instantiate DataManager.
        self.data_manager = DataManager()

        # Create BoxLayout container.
        bx = BoxLayout(orientation='vertical')

        # Add stop flag for threading management.
        bx.stop = threading.Event()

        # Create ActionBar and pass it a reference to the screen manager.
        ab = NavigationBar(sm)
        ab.sm = sm

        # Fill BoxLayout.
        bx.add_widget(ab)
        bx.add_widget(sm)

        # Pass reference of navigation bar to screen manager.
        sm.nav_bar = ab

        # Create Settings widget and add to settings screen.
        with open(os.path.join(dirname, 'es_gui', 'resources', 'settings', 'general.json'), 'r') as settings_json:
            self.settings.add_json_panel('General', self.config, data=settings_json.read())
        
        with open(os.path.join(dirname, 'es_gui', 'resources', 'settings', 'data_manager.json'), 'r') as settings_json:
            self.settings.add_json_panel('QuESt Data Manager', self.config, data=settings_json.read())
        
        with open(os.path.join(dirname, 'es_gui', 'resources', 'settings', 'valuation.json'), 'r') as settings_json:
            self.settings.add_json_panel('QuESt Valuation', self.config, data=settings_json.read())
        
        with open(os.path.join(dirname, 'es_gui', 'resources', 'settings', 'btm.json'), 'r') as settings_json:
            self.settings.add_json_panel('QuESt BTM', self.config, data=settings_json.read())

        self.settings.bind(on_close=sm.settings_screen.dismiss)
        sm.settings_screen.settings_box.add_widget(self.settings)

        return bx
Пример #17
0
    def SetPageEffect(self,*,uEffect:str) -> bool:
        """ Sets the page effect for showing a page """
        self.uCurrentEffect = uEffect
        try:
            if uEffect==u'':
                return True
            uType=ToUnicode(type(self.oRootSM.transition))
            if uEffect==u'no':
                self.oRootSM.transition = NoTransition()
            if uEffect==u'fade':
                if uType.endswith(u'FadeTransition\'>'):
                    return True
                self.oRootSM.transition = FadeTransition()
            elif uEffect==u'slide':
                if uType.endswith(u'SlideTransition\'>'):
                    return True
                self.oRootSM.transition = SlideTransition()
            elif uEffect==u'wipe':
                if uType.endswith(u'WipeTransition\'>'):
                    return True
                self.oRootSM.transition = WipeTransition()
            elif uEffect==u'swap':
                if uType.endswith(u'SwapTransition\'>'):
                    return True
                self.oRootSM.transition = SwapTransition()
            elif uEffect==u'fallout':
                if uType.endswith(u'FallOutTransition\'>'):
                    return True
                self.oRootSM.transition = FallOutTransition()
            elif uEffect==u'risein':
                if uType.endswith(u'RiseInTransition\'>'):
                    return True
                self.oRootSM.transition = RiseInTransition()

            # noinspection PyArgumentList
            self.oRootSM.transition.bind(on_complete=self.On_Transition_Complete)
            # noinspection PyArgumentList
            self.oRootSM.transition.bind(on_progress=self.On_Transition_Started)
            return True

        except Exception as e:
            ShowErrorPopUp(uMessage=LogError(uMsg=u'TheScreen: Can not set page effect:' + uEffect,oException=e))
            return False
Пример #18
0
def GameOver():
    '''
    This function is called when the clock ran out and the game ends.
    The user is Propmted for their name, and it's entered in the high score file
    and list if it is among the top 5 scores. The top five scores are displayed.
    Highscores are written to a file named high_scores.txt, if there doesn't
    exist one one is created.
    '''

    try: # check that data is initialized
        GameOver.input_text
    except AttributeError: # initialize data
        GameOver.input_text = None
        GameOver.score_list = []
    
    # update board status and animations
    _Board._highlighted.clear()
    Clock.unschedule(_Board.game_timer.tile_drop)
    _Board.game_timer.cover_timer = -1
    _Board.tile_cover.pos = -5000, -5000
    _Board.manager.transition = RiseInTransition(duration=.5)
    _Board.manager.current = 'menu'
    
    # create the popup prompt for user name
    box = BoxLayout()
    text_in = TextInput(multiline = False, font_size = 40)
    box.add_widget(text_in)

    popup = Popup(title='Enter Your Name')
    popup.content = box
    popup.auto_dismiss = False
    popup.size_hint = (None, None)
    popup.size=(550, 120)

    # go to last screen when user presses 'enter'
    text_in.on_text_validate = LastScreen
    
    GameOver.input_text = text_in
    GameOver.input_text.popup = popup
    
    
    # Read in highscore file of 5 highest scores must end with newline
    try:
        file = open('high_scores.txt', 'r')
        for line in file:
            line = line.strip().split(",")
            line[1] = ' '.join(line[1].split())
            try:
                GameOver.score_list.append((line[0],line[1])) 
            except:
                # if blank line do nothing
                continue
        file.close()
    except:
        # Do nothing if no file or empty line
        pass

    # THIS SHOULDN'T HAPPEN, but if the highscore file ended up
    # with more than 5 things in it, we will rewrite the new one to have 5
    # by removing lowest scores
    while(len(GameOver.score_list)>5):
        GameOver.score_list.pop(0)

    # IF LIST LESS THAN 5 RECORDS LONG THEN FILL IT WITH EMPTIES
    while(len(GameOver.score_list)<5):
        GameOver.score_list = [(0, 'No Record Yet')] + GameOver.score_list
    
    popup.open()
Пример #19
0
 def on_press(self):
     self.parent.parent.parent.parent.parent.transition = RiseInTransition()
     self.parent.parent.parent.parent.parent.current = self.name
Пример #20
0
 def __init__(self, **kwargs):
     super(Juggler, self).__init__(**kwargs)
     self.fade = FadeTransition()
     self.fall = FallOutTransition()
     self.rise = RiseInTransition()
     self.transition = self.fade
Пример #21
0
 def prototype(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'prototype'
Пример #22
0
def home_screen():
    controller.transition = RiseInTransition()
    controller.current = "Home"
Пример #23
0
 def b_improve(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'bimprove'
Пример #24
0
    def calc_risk(self):
        if "AGE" in values and values["AGE"]:
            age = 30
            try:
                age = float(values["AGE"])
            except ValueError:
                pass
            except TypeError:
                pass
            if age < 10 or 50 < age:
                res_scr.curr_risk_color = [
                    153.0 / 255, 93.0 / 255, 77.0 / 255, 1
                ]
                res_scr.curr_risk_label = 'HIGH RISK'
                res_scr.curr_risk_level = 1
                sm.current = 'result'
                return

        # Find highest ranking model that contained in the provided variables
        model_dir = None
        model_vars = None
        vv = set([])
        for k in values:
            if values[k]: vv.add(k)
        print vv
        for info in models_info:
            v = set(info[1])
            res = v.issubset(vv)
            #print res, info[1]
            if res:
                model_dir = info[0]
                model_vars = info[1]
                break

        if not model_dir or not models_info:
            res_scr.curr_risk_color = [0.5, 0.5, 0.5, 1]
            res_scr.curr_risk_label = 'INSUFFICIENT DATA'
            res_scr.curr_risk_level = 0
            sm.transition = RiseInTransition()
            sm.current = 'result'
            return

        print "FOUND MODEL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
        print model_dir
        print model_vars

        predictor = gen_predictor(os.path.join(model_dir, 'nnet-params'))
        N = len(model_vars)

        model_min = []
        model_max = []
        with open(os.path.join(model_dir, 'bounds.txt')) as bfile:
            lines = bfile.readlines()
            for line in lines:
                line = line.strip()
                parts = line.split()
                model_min.append(float(parts[1]))
                model_max.append(float(parts[2]))

        print model_min
        print model_max

        v = [None] * (N + 1)
        v[0] = 1
        for i in range(N):
            var = model_vars[i]
            if var in values:
                try:
                    v[i + 1] = float(values[var])
                    if var in units and units[var] != var_def_unit[var]:
                        # Need to convert units
                        c, f = var_unit_conv[var]
                        print "convert", var, v[i +
                                                1], "->", f * (v[i + 1] + c)
                        v[i + 1] = f * (v[i + 1] + c)
                except ValueError:
                    pass
                except TypeError:
                    pass

        if None in v:
            res_scr.curr_risk_color = [0.5, 0.5, 0.5, 1]
            res_scr.curr_risk_label = 'INSUFFICIENT DATA'
            res_scr.curr_risk_level = 0
            sm.current = 'result'
            return

        for i in range(N):
            f = (v[i + 1] - model_min[i]) / (model_max[i] - model_min[i])
            if f < 0: v[i + 1] = 0
            elif 1 < f: v[i + 1] = 1
            else: v[i + 1] = f

        print values
        print v

        X = np.array([v])
        probs = predictor(X)
        pred = probs[0]
        print "------------->", pred, type(pred)
        res_scr.curr_risk_level = float(pred)
        if pred < 0.5:
            res_scr.curr_risk_color = [
                121.0 / 255, 192.0 / 255, 119.0 / 255, 1
            ]
            res_scr.curr_risk_label = 'LOW RISK'
        else:
            level = float((pred - 0.5) / 0.5)
            res_scr.curr_risk_color = [153.0 / 255, 93.0 / 255, 77.0 / 255, 1]
            res_scr.curr_risk_label = 'HIGH RISK'
        sm.transition = RiseInTransition()
        #sm.transition = SlideTransition(direction='left')
        sm.current = 'result'
Пример #25
0
 def build(self):
     self.title = 'CRSum抽取式摘要系統'
     self.icon = getResourcePath('icon.png')
     return RootScreenManager(transition=RiseInTransition(duration=0.4))
Пример #26
0
 def yahoocrusher(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'yahoocrush'
Пример #27
0
 def show_image(self, widget, touch):
     Logger.debug("%s: show_image" % APP)
     if self.planilla.pw.collide_point(*touch.pos):
         self.scmgr.transition = RiseInTransition()
         self.scmgr.current = 'image'
Пример #28
0
 def knowmore(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'knowmore'
Пример #29
0
 def yahootwin(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'yahootwin'
Пример #30
0
 def edit_login(self):
     self.manager.transition = RiseInTransition()
     self.manager.current = 'editlogin'