コード例 #1
0
    def game_over_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Your score: ' + str(
            self.score) + '\nHighest score: ' + str(self.highest_score)
        if self.critical:
            myLabel.text = myLabel.text + '\nYou must score at least ' + str(
                self.goal) + '\nto unlock next level'

        button = Button()
        button.text = 'Ok'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Result: Level ' + str(self.puzzle_index + 1)
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=self.reset_timer)

        self.game_over_message_popUp = popUp
        self.game_over_message_popUp.open()
コード例 #2
0
    def artist_unavailable_popUp(self):

        #MOVE THESE TO SOMEWHERE BETTER

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Artist fanpage is\nunavailable at this time'

        button = Button()
        button.text = 'Dismiss'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Level locked'
        popUp.content = myBox
        popUp.size_hint = (0.5, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=popUp.dismiss)

        popUp.open()
コード例 #3
0
    def state_goal_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()

        if ArtInfo.max_score[self.puzzle_index] != None:
            myLabel.text = 'Reach score of ' + str(
                self.goal) + '\nto unlock next stage.\n\
Maximum score: ' + str(ArtInfo.max_score[self.puzzle_index])
        else:
            myLabel.text = 'Reach score of ' + str(
                self.goal) + '\nto unlock next stage.\n\
Maximum score: unlimtied'

        button = Button()
        button.text = 'Ok!'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Mission'
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=self.start_timing_press)

        return popUp
コード例 #4
0
    def disrupt_game_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'This will quit the current game.\nAre you sure?'

        button1 = Button()
        button1.text = 'Yes'
        button1.size_hint_y = 0.2

        button2 = Button()
        button2.text = 'No'
        button2.size_hint_y = 0.2

        bar = Widget()
        bar.size_hint_y = 0.02

        myBox.add_widget(myLabel)
        myBox.add_widget(button1)
        myBox.add_widget(bar)
        myBox.add_widget(button2)

        popUp = Popup()
        popUp.title = 'Stop the game?'
        popUp.content = myBox
        popUp.size_hint = (0.9, 0.8)
        popUp.auto_dismiss = False

        #button.bind(on_release=popUp.dismiss)
        button1.bind(on_release=self.disrupt_yes)
        button2.bind(on_release=self.disrupt_no)

        return popUp
コード例 #5
0
 def select_color(self, instance):
     popup = Popup(title="Select light color", size_hint=(0.75, 0.75))
     popup.auto_dismiss = False
     _id = instance.id
     buttoninstance = instance
     popup.content = self.open_colorpicker_popup(popup, _id, buttoninstance)
     popup.open()
コード例 #6
0
    def create_popup(popup_title, size_x, size_y, layout, title_size):
        popup = Popup(title=popup_title)
        popup.size_hint = (size_x, size_y)
        popup.content = layout
        popup.title_size = title_size
        popup.title_align = 'center'
        popup.auto_dismiss = False

        return popup
コード例 #7
0
ファイル: stats.py プロジェクト: SysRq-Tech/ScadsStats
    def use_token(self, parent_popup, force=False):
        parent_popup.dismiss()

        self.content = Token()
        popup = Popup(title=_("Вход по токену"),
                      title_size='16pt',
                      content=self.content,
                      size_hint=(0.8, 0.65))
        if force:
            popup.auto_dismiss = False
        self.content.link.bind(on_ref_press=Partial(open_url, "http://vk.cc/3T1J9A"))
        self.content.login.bind(on_press=Partial(self.token_auth, popup))
        popup.open()
コード例 #8
0
ファイル: stats.py プロジェクト: SysRq-Tech/ScadsStats
 def login(force=False, parent=None):
     if parent is not None:
         parent.dismiss()
     content = Login()
     popup = Popup(title=_("Вход по паролю"),
                   title_size='16pt',
                   content=content,
                   size_hint=(0.8, 0.55))
     if force:
         popup.auto_dismiss = False
     content.by_token.bind(on_press=Partial(content.use_token, popup, force=force))
     content.log_in.bind(on_press=Partial(content.auth, popup))
     popup.open()
コード例 #9
0
ファイル: stats.py プロジェクト: sysrqtech/ScadsStats
 def login(force=False, parent=None):
     if parent is not None:
         parent.dismiss()
     content = Login()
     popup = Popup(title=_("Вход по паролю"),
                   title_size='16pt',
                   content=content,
                   size_hint=(0.8, 0.55))
     if force:
         popup.auto_dismiss = False
     content.by_token.bind(
         on_press=Partial(content.use_token, popup, force=force))
     content.log_in.bind(on_press=Partial(content.auth, popup))
     popup.open()
コード例 #10
0
ファイル: stats.py プロジェクト: sysrqtech/ScadsStats
    def use_token(self, parent_popup, force=False):
        parent_popup.dismiss()

        self.content = Token()
        popup = Popup(title=_("Вход по токену"),
                      title_size='16pt',
                      content=self.content,
                      size_hint=(0.8, 0.65))
        if force:
            popup.auto_dismiss = False
        self.content.link.bind(
            on_ref_press=Partial(open_url, "http://vk.cc/3T1J9A"))
        self.content.login.bind(on_press=Partial(self.token_auth, popup))
        popup.open()
コード例 #11
0
    def view_art_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        if self.critical:
            myLabel.text = 'You have completed the puzzle!\n\nNote: You must win with timer\nto unlock next level'
        else:
            myLabel.text = 'You have completed the puzzle!'

        if self.artist != None and self.artist != 'flickr':
            button = Button()
            button.text = 'More arts by ' + self.artist
            button.size_hint_y = 0.2
            button.bind(on_release=self.open_fanpage)

        button1 = Button()
        button1.text = 'View full image'
        button1.size_hint_y = 0.2

        button2 = Button()
        button2.text = 'Replay'
        button2.size_hint_y = 0.2

        bar = Widget()
        bar.size_hint_y = 0.02
        bar2 = Widget(size_hint_y=0.02)

        myBox.add_widget(myLabel)
        myBox.add_widget(button1)
        myBox.add_widget(bar)
        if self.artist != None and self.artist != 'flickr':
            myBox.add_widget(button)
        myBox.add_widget(bar2)
        myBox.add_widget(button2)

        popUp = Popup()
        popUp.title = 'You won!'
        popUp.content = myBox
        popUp.size_hint = (0.9, 0.8)
        popUp.auto_dismiss = False

        #button.bind(on_release=popUp.dismiss)
        button1.bind(on_release=self.view_image)
        button2.bind(on_release=self.re_play)

        return popUp
コード例 #12
0
    def load_active_workbook(self, *args):
        popup_label = Label(text='Opening File...')
        popup = Popup(title='Loading', content=popup_label, auto_dismiss=False)
        popup.open()
        try:
            popup_label.text = 'Getting Workbook name'
            ## Windows code
            print("test")
            wb = self.OSManager.get_active_excel()

            popup_label.text = 'Loading Data...'
            self.load_data_file([wb])
            popup_label.text = 'Done'
        except Exception as e:
            popup_label.text = 'Failed: {}'.format(e)
            print('Failed to retrieve active excel workbook', e,
                  traceback.print_exc())
            popup.auto_dismiss = True
        else:
            popup.dismiss()
コード例 #13
0
ファイル: main.py プロジェクト: zxzion/kivybits
    def select_color(self, instance, no_buts=True):
        '''
        The button click has fired the event, so show the popup.
        no_buts is  boolean and specifies whether to include buttons
        in the popup or not.
        '''
        popup = Popup(title="Select your colour", size_hint=(0.75, 0.75))

        # NOTE: the below properties can also be passed in to the Popup
        # constructor but we do them separately for clarity.
        if no_buts:
            colorPicker = ColorPicker()
            popup.bind(
                on_dismiss=lambda popup: \
                    self.popup_dismissed(popup, colorPicker.hex_color))
            popup.content = colorPicker
        else:
            # We prevent the default dismiss behaviour and roll our own in
            # the content.
            popup.auto_dismiss = False
            popup.content = self.get_ok_cancel_content(popup)
        popup.open()
コード例 #14
0
    def max_score_reached_popUp(self):
        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Maximum score possible reached\nUnlimited score is allowed in\nhigh level stages'

        button = Button()
        button.text = 'Dismiss'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Max score for level reached'
        popUp.content = myBox
        popUp.size_hint = (0.9, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=self.handle_max_reached)

        return popUp
コード例 #15
0
ファイル: main.py プロジェクト: Zen-CODE/kivybits
    def select_color(self, instance, no_buts=True):
        '''
        The button click has fired the event, so show the popup.
        no_buts is  boolean and specifies whether to include buttons
        in the popup or not.
        '''
        popup = Popup(
            title="Select your colour",
            size_hint=(0.75, 0.75))

        # NOTE: the below properties can also be passed in to the Popup
        # constructor but we do them separately for clarity.
        if no_buts:
            colorPicker = ColorPicker()
            popup.bind(
                on_dismiss=lambda popup: \
                    self.popup_dismissed(popup, colorPicker.hex_color))
            popup.content = colorPicker
        else:
            # We prevent the default dismiss behaviour and roll our own in
            # the content.
            popup.auto_dismiss = False
            popup.content = self.get_ok_cancel_content(popup)
        popup.open()
コード例 #16
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()