Example #1
0
class CalendarButton(FloatLayout):

	def __init__(self, activity, **kwargs):
		self.activity = activity

		super(CalendarButton, self).__init__()
		
		self.buttonInstance = Button(size_hint=(1, 1), pos_hint={'center_x':0.5, 'center_y':0.5}, **kwargs)
		self.buttonInstance.bind(on_release=self.onPressBubble)
		self.add_widget(self.buttonInstance)

		self.bubbleInstance = Bubble(size_hint=(None, None), size=(100, 40), pos_hint={'center_x':0.5, 'center_y':0.5}, arrow_pos='bottom_mid')
		
		self.bubbleChange = BubbleButton(text='Change', font_size=8)
		self.bubbleChange.bind(on_release=self.onPressChange)
		self.bubbleRemove = BubbleButton(text='Remove', font_size=8)
		self.bubbleRemove.bind(on_release=self.onPressRemove)
		
		self.bubbleInstance.add_widget(self.bubbleChange)
		self.bubbleInstance.add_widget(self.bubbleRemove)

	def onPressBubble(self, instance):
		if self.bubbleInstance.parent == None:
			self.add_widget(self.bubbleInstance)
		else:
			self.remove_widget(self.bubbleInstance)
	
	def onPressChange(self, instance):
		self.remove_widget(self.bubbleInstance)
		changeActivity(self.activity)
	
	def onPressRemove(self, instance):
		self.remove_widget(self.bubbleInstance)
		removeActivity(self.activity)
Example #2
0
    def _on_dropdown_select(self, instance, data, *largs):
        self.text = data
        self.is_open = False
        #print('select function',self.text)
        self.func_des = '[color=#ffff00][i][b]' + self.parent.tool_library.read_obj.get_func_des(
            self.text) + '[/i][/b][/color]'
        self.set_select_parameter(self.text)

        if self.bubble is None:

            self.bubble = Bubble(size_hint=(.3, .2))
            self.bubb_layout = AnchorLayout(anchor_x='right', anchor_y='top')

            def remove_bubble(instance):
                self.bubb_layout.remove_widget(self.bubble)
                self.parent.parent.remove_widget(self.bubb_layout)
                self.bubble = None
                self.bubb_layout = None

            self.button = BubbleButton(text=self.func_des,
                                       halign='left',
                                       valign='middle',
                                       text_size=(300, 300),
                                       background_color=(0, 0, 1, 1),
                                       markup=True)
            self.button.bind(on_press=remove_bubble)
            self.bubble.add_widget(self.button)
            self.bubble.arrow_pos = 'top_mid'
            self.bubb_layout.add_widget(self.bubble)
            self.parent.parent.parent.add_widget(self.bubb_layout)

        else:
            self.button.text = self.func_des
Example #3
0
    def __init__(self, *args, **kwargs):
        """Initialize."""
        super(PlayerActions, self).__init__(*args, **kwargs)

        self.player = kwargs['player']
        self.pos = kwargs['position']
        self.size = kwargs['size']
        self.is_paired = kwargs['is_paired']
        self.game_paused = kwargs['is_paused']
        self.scoreboard_address = kwargs['address']
        self.size_hint = (None, None)

        self.add_btn = BubbleButton(on_press=self.add_player,
                                    text='Add player',
                                    disabled=kwargs['is_registered']
                                    or kwargs['is_paused'])
        self.rm_btn = BubbleButton(on_press=self.remove_player,
                                   text='Remove player',
                                   disabled=not kwargs['is_registered']
                                   or kwargs['is_paused'])
        pair_txt = 'Unpair remote' if self.is_paired else 'Pair remote'
        self.pair_btn = BubbleButton(on_press=self.pair_remote,
                                     text=pair_txt,
                                     disabled=not kwargs['is_registered'])
        self.add_widget(self.add_btn)
        self.add_widget(self.rm_btn)
        self.add_widget(self.pair_btn)
Example #4
0
    def open_bubble_not_set(self, ti_not_set):

        float_lay = FloatLayout()
        float_lay.size_hint = None, None
        float_lay.width = 0
        float_lay.height = 0


        bubble_not_set = Bubble()
        bubble_not_set.size_hint = None, None
        bubble_not_set.width = 80
        bubble_not_set.height = 30
        bubble_not_set.center_x = ti_not_set.center_x
        bubble_not_set.center_y = ti_not_set.center_y - 30
        bubble_not_set.arrow_pos = 'top_mid'
        bubble_not_set.background_color = (1, 0, 0, 1)


        bt_not_set = BubbleButton()
        bt_not_set.font_size = 12

        bt_not_set.text = self.lang['Not_Set']

        bubble_not_set.add_widget(bt_not_set)

        float_lay.add_widget(bubble_not_set)

        #self.add_widget(bubble_not_set)
        self.lay_file_asc.add_widget(float_lay)
        parallel_close = threading.Thread(target=self.close_bubble_not_set, args=(float_lay,))
        parallel_close.start()
Example #5
0
    def on_release(self):
        if not self.channel:
            self.showChannelSelectDialog()
        else:
            bubble = CustomizeGaugeBubble()
            buttons = []
            if self.is_removable:
                buttons.append(
                    BubbleButton(text='Remove',
                                 on_press=lambda a: self.removeChannel()))
            if self.is_channel_selectable:
                buttons.append(
                    BubbleButton(text='Select Channel',
                                 on_press=lambda a: self.selectChannel()))
            buttons.append(
                BubbleButton(text='Customize',
                             on_press=lambda a: self.customizeGauge()))
            if len(buttons) == 1:
                buttons[0].dispatch('on_press')
            else:
                for b in buttons:
                    bubble.add_widget(b)

                bubble_height = dp(150)
                bubble_width = dp(200)
                bubble.size = (bubble_width, bubble_height)
                bubble.auto_dismiss_timeout(Gauge.POPUP_DISMISS_TIMEOUT_SHORT)
                self._customizeGaugeBubble = bubble
                self.add_widget(bubble)
                bubble.center_on_limited(self)
Example #6
0
    def open_bubble_not_set(self, ti_not_set):

        float_lay = FloatLayout()
        float_lay.size_hint = None, None
        float_lay.width = 0
        float_lay.height = 0

        bubble_not_set = Bubble()
        bubble_not_set.size_hint = None, None
        bubble_not_set.width = 80
        bubble_not_set.height = 30
        bubble_not_set.center_x = ti_not_set.center_x
        bubble_not_set.center_y = ti_not_set.center_y - 30
        bubble_not_set.arrow_pos = 'top_mid'
        bubble_not_set.background_color = (1, 0, 0, 1)

        bt_not_set = BubbleButton()
        bt_not_set.font_size = 12

        bt_not_set.text = self.lang['Not_Set']

        bubble_not_set.add_widget(bt_not_set)

        float_lay.add_widget(bubble_not_set)

        #self.add_widget(bubble_not_set)
        self.lay_file_asc.add_widget(float_lay)
        parallel_close = threading.Thread(target=self.close_bubble_not_set,
                                          args=(float_lay, ))
        parallel_close.start()
Example #7
0
 def _open(self, *args, **kwargs):
     try:
         self.remove_widget(self.bubble)
         self.percentage = self.slider.value
         del self.bubble, self.slider
         self.update_icons()
     except AttributeError:
         self.bubble = Bubble(orientation="vertical", size=(48, 200))
         self.update_bubble_pos()
         self.bind(pos=self.update_bubble_pos)
         def on_perc(slider, value):
             slider.btn.percentage = value
         label = Label(text=self.label, size_hint_y=None, height=25)
         self.bubble.add_widget(label)
         self.slider = Slider(orientation="vertical", min=0, max=100, value=self.percentage)
         self.slider.btn = self
         self.slider.bind(value=on_perc)
         self.bubble.add_widget(self.slider)
         def on_reset(bbtn, *args, **kwargs):
             bbtn.slider.value = bbtn.reset_value
         bbtn = BubbleButton(text=self.reset_text, size_hint_y=None, height=40)
         bbtn.slider = self.slider
         bbtn.reset_value = self.reset_value
         bbtn.bind(on_release=on_reset)
         self.bubble.add_widget(bbtn)
         self.add_widget(self.bubble)
         self.icon = self.icons["close"]
Example #8
0
    def test_add_content_with_buttons(self):
        bubble = Bubble()

        content = BubbleContent()
        content.add_widget(BubbleButton(text="Option A"))
        content.add_widget(BubbleButton(text="Option B"))

        bubble.add_widget(content)
        self.render(bubble)
    def CreatePostWidgets(self):
        parent_widget = self.ids.post_widget  # access the parent widget that
        # will hold all the post,
        # which are child widgets of it
        try:
            MockServerInterface.get_posts(self)
            parent_widget.clear_widgets()
            for post in MockServerInterface.temp_posts:

                post_owner = str(post['postid'])
                post_content = "Content: " + post['content'] + "\n" +  \
                            "Time: " + post['time'] + "\n"

                second_layer = GridLayout(cols=1)
                second_layer.add_widget(
                    BubbleButton(text=post['username'],
                                 background_color=(0.0, 1.0, 1.0, 1.0)))

                second_layer.add_widget(Label(text=post_content))

                third_layer = BoxLayout()

                third_layer.add_widget(
                    BubbleButton(id=post_owner,
                                 text='LIKE: ' + str(post['upvotes']),
                                 background_color=(0.0, 1.0, 1.0, 1.0)))
                # on_press= post['upvotes'])

                third_layer.add_widget(
                    BubbleButton(id='edit ' + post_owner,
                                 text='EDIT',
                                 background_color=(0.0, 1.0, 1.0, 1.0)))
                third_layer.add_widget(
                    BubbleButton(id='reply_to_' + post_owner,
                                 text='REPLY',
                                 background_color=(0.0, 1.0, 1.0, 1.0)))
                third_layer.add_widget(
                    BubbleButton(id='delete_' + post_owner,
                                 text='DELETE',
                                 background_color=(0.0, 1.0, 1.0, 1.0)))

                second_layer.add_widget(third_layer)
                parent_widget.add_widget(second_layer)
                # parent_widget.add_widget(Button(id=post_owner, text=post_content,
                # size_hint_y=10))
        except ServerInterfaceException as e:
            content = BoxLayout(orientation='vertical')
            message_label = Label(text=str(e))
            dismiss_button = Button(text='OK')
            content.add_widget(message_label)
            content.add_widget(dismiss_button)
            popup = Popup(title='Error',
                          content=content,
                          size_hint=(0.3, 0.25))
            dismiss_button.bind(on_press=popup.dismiss)
            popup.open()
Example #10
0
	def signal(self):
		my_bubble= Bubble(orientation = 'vertical',size_hint=(None, None),size=(600, 100),pos=(200,0))
		my_bubble.background_color =(20, 0, 0, .5) 
		my_bubble.border = [50, 50, 50, 10]
		my_bubble.size = (150, 50)
		my_bubble.arrow_pos= 'top_mid'
		my_bub_btn1= BubbleButton(text='Remove signal')
		#my_bub_btn1.bind(on_release=lambda my_bub_btn1: self.Update(1, my_bubble, my_bub_btn1))
		my_bub_btn1.bind(on_release=lambda my_bub_btn1: self.RemoveBub(my_bubble))
		my_bubble.add_widget(my_bub_btn1)
		self.add_widget(my_bubble)
Example #11
0
class ToolSelectFunction(Spinner):
    def __init__(self, **kwargs):
        self.map_pars = {}
        self.bubble = None
        self.bubb_layout = None
        self.button = None
        self.func_des = None
        self.background_color = (0.46, 0.46, 0.46, 0.6)
        super(ToolSelectFunction, self).__init__(**kwargs)

    def _on_dropdown_select(self, instance, data, *largs):
        self.text = data
        self.is_open = False
        #print('select function',self.text)
        self.func_des = '[color=#ffff00][i][b]' + self.parent.tool_library.read_obj.get_func_des(
            self.text) + '[/i][/b][/color]'
        self.set_select_parameter(self.text)

        if self.bubble is None:

            self.bubble = Bubble(size_hint=(.3, .2))
            self.bubb_layout = AnchorLayout(anchor_x='right', anchor_y='top')

            def remove_bubble(instance):
                self.bubb_layout.remove_widget(self.bubble)
                self.parent.parent.remove_widget(self.bubb_layout)
                self.bubble = None
                self.bubb_layout = None

            self.button = BubbleButton(text=self.func_des,
                                       halign='left',
                                       valign='middle',
                                       text_size=(300, 300),
                                       background_color=(0, 0, 1, 1),
                                       markup=True)
            self.button.bind(on_press=remove_bubble)
            self.bubble.add_widget(self.button)
            self.bubble.arrow_pos = 'top_mid'
            self.bubb_layout.add_widget(self.bubble)
            self.parent.parent.parent.add_widget(self.bubb_layout)

        else:
            self.button.text = self.func_des

    def set_select_parameter(self, function):
        self.parent.tool_parameter.text = 'Select Parameter'
        self.map_pars = self.parent.tool_library.read_obj.get_pars_type(
            function)

        #print('map_pars',map_pars)
        self.parent.tool_parameter.values = self.map_pars.keys()
Example #12
0
    def get_conversation_list(self):
        uid = MockServerInterface.temp_uid
        token = MockServerInterface.temp_token

        try:
            MockServerInterface.get_conversations(self, uid, token)
            conversations = MockServerInterface.temp_conversationdict
            holder = self.ids.conversation_holder

            holder.clear_widgets()
            for item in conversations:
                layer1 = GridLayout(cols=1)
                layer1.add_widget(
                    BubbleButton(text=item['username'],
                                 size_hint=(1, 2),
                                 background_color=(0.0, 1.0, 1.0, 1.0)))
                holder.add_widget(layer1)
                ConversationScreen.temp_convo_holder = holder

        except ServerInterfaceException as e:
            content = BoxLayout(orientation='vertical')
            message_label = Label(text=str(e))
            dismiss_button = Button(text='OK')
            content.add_widget(message_label)
            content.add_widget(dismiss_button)
            popup = Popup(title='Error',
                          content=content,
                          size_hint=(0.3, 0.25))
            dismiss_button.bind(on_press=popup.dismiss)
            popup.open()
    def get_all_messages(self):
        senderid = LoginScreen.current_uid
        otherid = ChoosePMRecipient.chosen_uid
        token = MockServerInterface.temp_token
        messages_holder = self.ids.holder_label

        try:
            MockServerInterface.get_messages(self, senderid,
                                            otherid,
                                            token)
            messages_holder.clear_widgets()
            for item in MockServerInterface.temp_messagedict:
                layer1 = GridLayout(cols=1, size_hint=(1, 2))
                layer1.add_widget(BubbleButton(text=item['sender'] +
                                                    ' said: ' +
                                              item['content'] + '\n\n'+
                                                        item['time'],
                                             size_hint=(1,10)))

                messages_holder.add_widget(layer1)
                PrivateMessenger.temp_message_holder = messages_holder

        except ServerInterfaceException as e:
            content = BoxLayout(orientation='vertical')
            message_label = Label(
                text=str(e))
            dismiss_button = Button(text='OK')
            content.add_widget(message_label)
            content.add_widget(dismiss_button)
            popup = Popup(title='Error', content=content,
                          size_hint=(0.3, 0.25))
            dismiss_button.bind(on_press=popup.dismiss)
            popup.open()
Example #14
0
 def show_bubble(self) -> None:
     self.bubb = Bubble(size_hint=(None, None),
                        size=(160, 30),
                        pos_hint={'center_x': .5, 'y': .6})
     accuse = BubbleButton(text='Accuse')
     suspect = BubbleButton(text='Suspect')
     accuse.bind(on_press=partial(self.hide_bubble, accuse))
     suspect.bind(on_press=partial(self.hide_bubble, suspect))
     self.bubb.add_widget(accuse)
     self.bubb.add_widget(suspect)
     self.ids.empty.add_widget(self.bubb)
Example #15
0
 def show_bubble(self, bx, by):
     bubble = Bubble(size_hint=[None, None], size=[20, 20], pos=[bx, by])
     bubble.add_widget(
         BubbleButton(text='WRONG',
                      font_size='10sp',
                      color=[0, 0, 0, 1],
                      size=[6, 3]))
     bubble.background_color = (255, 0, 0, 1)
     bubble.arrow_pos = 'bottom_right'
     self.ids.bbox.add_widget(bubble)
     Clock.schedule_once(partial(self.remove_bubble, bubble), 1.5)
Example #16
0
 def __init__(self, **kwargs):
     dheight = 80
     dweight = 100
     calls = kwargs["calls"]
     ldweight = len(calls) * dweight
     super().__init__(size=(dheight, ldweight))
     for call in calls:
         # it is need to create lambda function which take 1 argument: self and call delegate
         # otherwise it try to give it to delegate and would fall
         button = BubbleButton(text=call["name"], on_press=lambda x, call_=call: call_["call"]())
         self.add_widget(button)
Example #17
0
 def show_timer(self):
     self.dynamic_button = "Pause"
     bubble = Bubble(size_hint=[None, None], size=[50, 35], pos=[375, 490])
     bubble.add_widget(
         BubbleButton(text='START',
                      font_size='15sp',
                      color=[0, 0, 0, 1],
                      size=[10, 10]))
     bubble.background_color = (0, 0, 0, 0)
     self.ids.bbox.add_widget(bubble)
     Clock.schedule_interval(self.Running_Clock, 1)
     Clock.schedule_once(partial(self.remove_bubble, bubble), 1)
Example #18
0
 def add_var(self, var_name, eqn_text, do_save=True):
     """Add to the variables bubble list and dictionary.
     
     Arguments:
     - `self`:
     - `var_name`:
     - `eqn_text`:
     """
     # This function was actually created and modeled after
     # self.add_to_history.  Relevant comments can be found there.
     var_exists = var_name in self.var_dict
     self.var_dict[var_name] = eqn_text
     if do_save:
         with open(VARDB_FILE, "wb") as var_file:
             pickle.dump(self.var_dict, var_file)
     if not var_exists:
         new_btn = BubbleButton(text=var_name)
         last_pos = len(self.var_dict)
         new_btn.bind(on_press=lambda *args: self.set_eqn(self.var_dict[var_name], len(self.history_stack) + 1))
         try:
             kivy.require("1.4.2")
             self.var_list_bubble.content.add_widget(new_btn, last_pos + 1)
         except Exception:
             self.var_list_bubble.content.clear_widgets()
             self.var_list_bubble.content.add_widget(new_btn)
             for dice_roll in reversed(self.var_list_stack):
                 dice_bubble = BubbleButton(text=dice_roll)
                 dice_bubble.bind(on_press=self.var_dict[dice_roll])
                 self.var_list_bubble.content.add_widget(dice_bubble)
             self.var_list_stack.append(var_name)
         if not hasattr(self, "bubble_height_var"):
             self.bubble_height_var = self.dice_eqn_input.height
         else:
             self.var_list_bubble.height += self.bubble_height_var
             self.var_list_bubble.parent.height += self.bubble_height_var
Example #19
0
 def timer_bubble(self, tx1, tx2, clr, fn):
     bubble = Bubble(size_hint=[None, None], size=[50, 35], pos=[375, 490])
     bubble.add_widget(
         BubbleButton(text="{:02d}:{:02d}".format(tx1, tx2),
                      font_size='15sp',
                      color=[0, 0, 0, clr],
                      size=[10, 10]))
     bubble.background_color = (0, 0, 0, 0)
     self.ids.bbox.add_widget(bubble)
     if fn == "stop":
         Clock.schedule_once(partial(self.remove_bubble, bubble), 60)
     if fn == "run":
         Clock.schedule_once(partial(self.remove_bubble, bubble), 1)
Example #20
0
 def openbubble(self, buttonfunclist, data=None):
     if self.bubble:
         logging.error("Bubble already called")
         return
     self.bubble = Bubble(height=30, width=10, pos=self.to_window(self.x, self.y+30), size_hint=(None, None))
     for text, func in buttonfunclist:
         button = BubbleButton(text=text, height=30)
         self.bubble.width += 10 + len(text)*10
         self.call(button, func, data)
         self.bubble.add_widget(button)
     root = App.get_running_app().root
     #self.get_root_window().add_widget(self.bubble, root.canvas)
     root.add_widget(self.bubble)
     self.callbackid = root.fbind("on_touch_down", self.touch_grab)
Example #21
0
 def on_touch_up(self, touch):
     touch.push()
     ret = super(Block, self).on_touch_up(touch)
     if self.collide_point(*touch.pos):
         if touch.is_double_tap:
             if self.bubble == None:
                 self.bubble = BlockBubble(self)
                 if len(self.settings_format) > 1:
                     self.bubble.add_widget(
                         BubbleButton(text='Settings',
                                      on_press=self.display_settings))
                 self.block_layout.add_widget(self.bubble)
     touch.pop()
     return ret
Example #22
0
    def create_bubble(self, instance, value):
        if not self.bubble_text:
            return

        if self.bubble_callback:
            self.funbind('mouse_hover', self.bubble_callback)

        text = self.bubble_text.strip()
        self.bubble = bubble = Bubble(size_hint=(None, None))
        self.bubble_button = bubble_button = BubbleButton(markup=True, text=text)
        bubble_button.bind(texture_size=lambda obj, size: bubble.setter('size')(bubble, (size[0] + 30, size[1] + 30)))
        bubble.add_widget(bubble_button)

        self.bubble_callback = partial(self.show_bubble, self, bubble, self.arrow_pos)

        # self.bind(mouse_hover=self.bubble_callback)
        self.fbind('mouse_hover', self.bubble_callback)
Example #23
0
 def add_to_history(self, eqn_text, do_save=True):
     """Add to equations history
     
     Arguments:
     """
     #new button to be added to the history list
     new_btn = BubbleButton(text = eqn_text)
     last_pos = len(self.history_stack) 
     eqn_fn = lambda *args: self.set_eqn(eqn_text, last_pos)
     if do_save:
         append_overwrite = 'a' if last_pos < 40 else 'w'
         with open(DICE_HISTORY_FILE, append_overwrite) as dh_file:
             # We only care about the last 40
             if last_pos >= 40:
                 for eqn in self.history_stack[last_pos-40:last_pos]:
                     dh_file.write(eqn + '\n')
             dh_file.write(eqn_text + '\n')
     new_btn.bind(on_press = eqn_fn)
     try:
         #kivy 1.4.2 will respect the order bubble buttons are
         #added
         kivy.require('1.4.2') #this will throw an exception if
                               #it's not 1.4.2 or later
         self.history_stack.append(eqn_fn)
         self.dice_history.content.add_widget(new_btn, last_pos+1)
     except Exception:
         #nasty ugly work around for kivy issue #819
         self.dice_history.content.clear_widgets()
         self.dice_history.content.add_widget(new_btn)
         for dice_roll in reversed(self.history_stack):
             dice_bubble = BubbleButton(text = dice_roll())
             dice_bubble.bind(on_press = dice_roll)
             self.dice_history.content.add_widget(dice_bubble)
         self.history_stack.append(eqn_fn)
     self.dice_eqn_input.history_stack_pos = last_pos+1
     if not hasattr(self, 'bubble_height'):
         self.bubble_height = self.dice_eqn_input.height
     else:
         self.dice_history.height += self.bubble_height
         #Why change the following? Because the parent is actually
         #an anchor layout.
         self.dice_history.parent.height += self.bubble_height
Example #24
0
    def on_state(self, widget, state):
        # super(SettingView, self).on_state(**kwargs)
        
        if self.state == 'down':
            bubbleHeight = 50
            self.bubble = Bubble(size_hint=(None,None), size=(self.width, bubbleHeight), center_x=self.center_x, y=self.height-bubbleHeight)
            b1 = BubbleButton(text="-", font_size=40)
            b1.bind(on_press = self.decr)
            b2 = BubbleButton(text="+", font_size=40)
            b2.bind(on_press = self.incr)
            self.text_size = self.size
            self.text_size[1] -= 10
            self.valign='bottom'
            self.bubble.add_widget(b1)
            self.bubble.add_widget(b2)

            self.add_widget(self.bubble)
        else:
            self.remove_widget(self.bubble)
            self.valign='center'
            self.dispatch('on_change', self.value)
Example #25
0
 def add_var(self, var_name, eqn_text, do_save=True):
     """Add to the variables bubble list and dictionary.
     
     Arguments:
     - `self`:
     - `var_name`:
     - `eqn_text`:
     """
     #This function was actually created and modeled after
     #self.add_to_history.  Relevant comments can be found there.
     var_exists = var_name in self.var_dict
     self.var_dict[var_name] = eqn_text
     if do_save:
         with open(VARDB_FILE, 'wb') as var_file:
             pickle.dump( self.var_dict, var_file )
     if not var_exists:
         new_btn = BubbleButton(text = var_name)
         last_pos = len(self.var_dict)
         new_btn.bind(on_press = lambda *args: self.set_eqn( \
                 self.var_dict[var_name], len(self.history_stack)+1))
         try:
             kivy.require('1.4.2')
             self.var_list_bubble.content.add_widget(new_btn, last_pos+1)
         except Exception:
             self.var_list_bubble.content.clear_widgets()
             self.var_list_bubble.content.add_widget(new_btn)
             for dice_roll in reversed(self.var_list_stack):
                 dice_bubble = BubbleButton(text = dice_roll)
                 dice_bubble.bind(on_press = self.var_dict[dice_roll])
                 self.var_list_bubble.content.add_widget(dice_bubble)
             self.var_list_stack.append(var_name)
         if not hasattr(self, 'bubble_height_var'):
             self.bubble_height_var = self.dice_eqn_input.height
         else:
             self.var_list_bubble.height += self.bubble_height_var
             self.var_list_bubble.parent.height += self.bubble_height_var
Example #26
0
 def add_to_history(self, eqn_text, do_save=True):
     """Add to equations history
     
     Arguments:
     """
     # new button to be added to the history list
     new_btn = BubbleButton(text=eqn_text)
     last_pos = len(self.history_stack)
     eqn_fn = lambda *args: self.set_eqn(eqn_text, last_pos)
     if do_save:
         append_overwrite = "a" if last_pos < 40 else "w"
         with open(DICE_HISTORY_FILE, append_overwrite) as dh_file:
             # We only care about the last 40
             if last_pos >= 40:
                 for eqn in self.history_stack[last_pos - 40 : last_pos]:
                     dh_file.write(eqn + "\n")
             dh_file.write(eqn_text + "\n")
     new_btn.bind(on_press=eqn_fn)
     try:
         # kivy 1.4.2 will respect the order bubble buttons are
         # added
         kivy.require("1.4.2")  # this will throw an exception if
         # it's not 1.4.2 or later
         self.history_stack.append(eqn_fn)
         self.dice_history.content.add_widget(new_btn, last_pos + 1)
     except Exception:
         # nasty ugly work around for kivy issue #819
         self.dice_history.content.clear_widgets()
         self.dice_history.content.add_widget(new_btn)
         for dice_roll in reversed(self.history_stack):
             dice_bubble = BubbleButton(text=dice_roll())
             dice_bubble.bind(on_press=dice_roll)
             self.dice_history.content.add_widget(dice_bubble)
         self.history_stack.append(eqn_fn)
     self.dice_eqn_input.history_stack_pos = last_pos + 1
     if not hasattr(self, "bubble_height"):
         self.bubble_height = self.dice_eqn_input.height
     else:
         self.dice_history.height += self.bubble_height
         # Why change the following? Because the parent is actually
         # an anchor layout.
         self.dice_history.parent.height += self.bubble_height
Example #27
0
    def _open(self, *args, **kwargs):
        try:
            self.remove_widget(self.bubble)
            self.percentage = self.slider.value
            del self.bubble, self.slider
            self.update_icons()
        except AttributeError:
            self.bubble = Bubble(orientation="vertical", size=(48, 200))
            self.update_bubble_pos()
            self.bind(pos=self.update_bubble_pos)

            def on_perc(slider, value):
                slider.btn.percentage = value

            label = Label(text=self.label, size_hint_y=None, height=25)
            self.bubble.add_widget(label)
            self.slider = Slider(orientation="vertical",
                                 min=0,
                                 max=100,
                                 value=self.percentage)
            self.slider.btn = self
            self.slider.bind(value=on_perc)
            self.bubble.add_widget(self.slider)

            def on_reset(bbtn, *args, **kwargs):
                bbtn.slider.value = bbtn.reset_value

            bbtn = BubbleButton(text=self.reset_text,
                                size_hint_y=None,
                                height=40)
            bbtn.slider = self.slider
            bbtn.reset_value = self.reset_value
            bbtn.bind(on_release=on_reset)
            self.bubble.add_widget(bbtn)
            self.add_widget(self.bubble)
            self.icon = self.icons["close"]
Example #28
0
 def start(self, uuid, market):
     bubble = Bubble(arrow_pos="right_mid")
     bubble.add_widget(BubbleButton(text=market))
     self.add_widget(bubble, 4)
Example #29
0
 def __init__(self, **kwargs):
     super(ccp, self).__init__(**kwargs)
     self.size_hint = (None, None)
     self.size = (80, 30)
     self.add_widget(BubbleButton(text='Data'))
     self.add_widget(BubbleButton(text='Delete'))
Example #30
0
 def create_option(text="", callback=None):
     option = BubbleButton(text=text, on_press=callback)
     return option
Example #31
0
    def show_objects(self):
        """
        Create the entire layout for all profiles present in the database
        :return: None
        """
        list_of_objects = self.interface_call.sql_to_object_screen()
        parent_widget = self.objects_holder

        parent_widget.clear_widgets()

        for item in list_of_objects:
            layout = GridLayout(cols=1,
                                size_hint=(1, parent_widget.size_hint_y * 10),
                                id=item['Title'])

            widg_1 = Label(text=item['Title'], size_hint=(1, .5))

            widg_2 = BoxLayout()
            widg_2_1 = Label(text='Creator: ' + item['Creator'])
            widg_2_2 = GridLayout(cols=1)
            shp_2_2 = Label(text='Shp Name: ' + item['ShpName'])
            dbf_2_2 = Label(text='Dbf Name: ' + item['DbfName'])
            widg_2_2.add_widget(shp_2_2)
            widg_2_2.add_widget(dbf_2_2)
            widg_2_3 = Label(text='Date: ' + item['Date'])

            widg_2.add_widget(widg_2_1)
            widg_2.add_widget(widg_2_2)
            widg_2.add_widget(widg_2_3)

            widg_3 = BoxLayout()

            widg_3_1 = BubbleButton(id=item['Title'],
                                    text='2D',
                                    color=[0, 0, 0, 1],
                                    size_hint=(1.0, .5),
                                    background_normal='',
                                    background_color=[1, 1, 1, 1])
            widg_3_1.bind(on_press=self.visual_screen_instance_2d)

            widg_3_2 = BubbleButton(id=item['Title'],
                                    text='3D',
                                    color=[0, 0, 0, 1],
                                    size_hint=(1.0, .5),
                                    background_normal='',
                                    background_color=[1, 1, 1, 1])
            widg_3_2.bind(on_press=self.visual_screen_instance_3d)

            widg_3_3 = BubbleButton(text='VR',
                                    color=[0, 0, 0, 1],
                                    size_hint=(1.0, .5),
                                    background_normal='',
                                    background_color=[1, 1, 1, 1])

            widg_3.add_widget(widg_3_1)
            widg_3.add_widget(widg_3_2)
            widg_3.add_widget(widg_3_3)

            layout.add_widget(widg_1)
            layout.add_widget(widg_2)
            layout.add_widget(widg_3)

            parent_widget.add_widget(layout)
Example #32
0
    def __init__(self, **kw):
        super(TransformBubble, self).__init__(**kw)
        self.size_hint = (0.5, None)
        self.size = (0, 200)
        self.pos_hint = {'right': 1, 'top': 1}
        self.arrow_pos = 'left_top'
        self.orientation = 'vertical'
        self.rows = 6

        # Create and bind each button.
        button = BubbleButton(text='Identity')
        button.bind(on_press=self.select_option)
        self.add_widget(button)

        button = BubbleButton(text='Translate')
        button.bind(on_press=self.select_option)
        self.add_widget(button)

        button = BubbleButton(text='Scale')
        button.bind(on_press=self.select_option)
        self.add_widget(button)

        button = BubbleButton(text='Rotate')
        button.bind(on_press=self.select_option)
        self.add_widget(button)

        button = BubbleButton(text='Shear')
        button.bind(on_press=self.select_option)
        self.add_widget(button)

        button = BubbleButton(text='Reflect')
        button.bind(on_press=self.select_option)
        self.add_widget(button)