Example #1
0
    def init(self):

        ## Define ActionItems
        self.actionItems = {
            'spinner':
            ActionSpinner(id='ctx_1',
                          color=(.3, .3, .3, 1),
                          option_cls=new_option),
            'new':
            ActionButton(id='ctx_2',
                         icon='theme/action_new.png',
                         on_release=self.new_preset),
            'accept':
            ActionButton(id='ctx_3',
                         icon='theme/action_accept.png',
                         on_release=self.save,
                         disabled=True,
                         opacity=0,
                         width=1)
        }

        ## Set up the spinner
        self.current_preset = App.get_running_app().config.getdefault(
            'Audio', 'eq_preset', 'standard')
        store = JsonStore('eq_presets.json')

        self.actionItems['spinner'].bind(text=self.load_preset)
        for preset in store.keys():
            self.actionItems['spinner'].values.append(preset)
        self.actionItems['spinner'].text = self.current_preset

        ## Add Items to ActionBar
        for item in self.actionItems:
            App.get_running_app().root.bar.children[0].add_widget(
                self.actionItems[item])
Example #2
0
 def __init__(self,dirs):
     super(TopAction, self).__init__()
     av = self.children[0]
     for d in dirs:
         b = ActionButton(text=d)
         b.bind(on_release=self.callback)
         av.add_widget(b)
    def __init__(self, **kwargs):
        super(BattleScreen, self).__init__(**kwargs)

        self.bScene = BattleScene()
        self.layout = BoxLayout(orientation='vertical')
        self.actionBar = ActionBar()
        self.view = ActionView()
        self.prompt = self.bScene.getTurn()
        self.nametag = ActionPrevious(title=self.prompt)
        self.MoveButton = ActionButton(text='Move')
        self.AttackButton = ActionButton(text='Attack')
        self.AbilityButton = ActionButton(text='Item')
        self.ConfirmButton = ActionButton(text='Take Turn')
        self.MoveButton.bind(on_press=self.Move)
        self.AttackButton.bind(on_press=self.Action)
        self.AbilityButton.bind(on_press=self.Ability)
        self.ConfirmButton.bind(on_press=self.TakeTurn)
        self.battleLog = 'Now Beginning Battle...'
        self.label = ScrollableLabel(text=self.battleLog)
        self.layout.add_widget(self.actionBar)
        self.layout.add_widget(self.label)
        self.actionBar.add_widget(self.view)
        self.view.add_widget(self.nametag)
        self.view.add_widget(self.MoveButton)
        self.view.add_widget(self.AttackButton)
        self.view.add_widget(self.AbilityButton)
        self.view.add_widget(self.ConfirmButton)
        self.add_widget(self.layout)
        self.Target = Combatants.get(0)
        Combatants.checkItems(0)
        if Combatants.getHasItems(0) == False:
            self.AbilityButton.disabled = True
Example #4
0
    def on_path(self, instance, path):
        #print "ONPATH"
        try:
            self.remove_widget(self.davbar)
        except:
            pass
        self.gen_actionbar()

        self.pathgroup = ActionGroup(text="Path")
        self.actionview.add_widget(self.pathgroup)

        seq = os.path.abspath(normpath(path)).split(os.sep)
        splitpath = []

        if platform != "win":
            splitpath.append("/")

        for i in seq:
            if i != "":
                splitpath.append(i)

        for i in splitpath:
            if i != "":
                btn = ActionButton(text=i,
                                   on_press=hide_keyboard,
                                   on_release=self.navigate)
                btn.path = os.path.normpath(
                    os.sep.join(splitpath[:splitpath.index(i) + 1]))
                self.pathgroup.add_widget(btn)
Example #5
0
    def on_path(self, instance, path):
        #print "ONPATH"
        try:
            self.remove_widget(self.davbar)
        except:
            pass
        self.gen_actionbar()

        self.pathgroup = ActionGroup(text="Path")
        self.actionview.add_widget(self.pathgroup)

        seq = os.path.abspath(normpath(path)).split(os.sep)
        splitpath = []

        if platform != "win":
            splitpath.append("/")

        for i in seq:
            if i != "":
                splitpath.append(i)

        for i in splitpath:
            if i != "":
                btn = ActionButton(text=i, on_press=hide_keyboard, on_release=self.navigate)
                btn.path = os.path.normpath(os.sep.join(splitpath[:splitpath.index(i)+1]))
                self.pathgroup.add_widget(btn)
Example #6
0
    def __init__(self):

        actionview = ActionView()
        actionview.use_separator=True
        ap = ActionPrevious(title='Action Bar', with_previous=False) 
        actionview.add_widget(ap) 
        self.abtn1=ActionButton(text="Btn1")
        self.abtn1.bind(on_press=self.ActionBtn1Callback)
        actionview.add_widget(self.abtn1) 
        self.abtn2=ActionButton(text="Btn2")
        self.abtn2.bind(on_press=self.ActionBtn2Callback)
        actionview.add_widget(self.abtn2) 

        self.abtn3=ActionButton(text="Btn3",icon="images.jpg")
        self.abtn3.bind(on_press=self.ActionBtn3Callback)
        actionview.add_widget(self.abtn3) 

        group1=ActionGroup()

        self.abtn4=ActionButton(text="Btn4")
        self.abtn4.bind(on_press=self.ActionBtn4Callback)
        group1.add_widget(self.abtn4)

        self.abtn5=ActionButton(text="Press Me!!!!")
        self.abtn5.bind(on_press=self.ActionBtn5Callback)
        group1.add_widget(self.abtn5)



        actionview.add_widget(group1)

        self.actionbar=ActionBar()
        self.actionbar.add_widget(actionview)
class CardBrowser(Screen):

    sb = ObjectProperty()
    sinput = ObjectProperty()
    junk = ObjectProperty()

    #method to create the search input in the actionbar
    def start_search(self, *args):
        #remove the 'search' button we had in the actionbar
        self.ids.av.remove_widget(self.ids.av.children[0])
        #creating the search textinput (presstextinput) and the exit button(recreates the initial actionbar)
        self.sinput = ActionText(font_size = 25, padding_y = [10,0])
        self.sinput.multiline = False
        self.sb = ActionButton (text = 'X',on_release = self.close)
        #bind the search presstextinput and our exit button
        self.sinput.my_button = self.sb
        self.ids.av.add_widget(self.sinput)
        self.ids.av.add_widget(self.sb)
        #the exit button is also our search button so we bind its state
        self.sb.bind(state = self.please_search)

    #method to recareate the actionbar
    def close(self, *args):
        self.ids.av.remove_widget(self.sinput)
        self.ids.av.remove_widget(self.sb)
        self.ids.av.add_widget(ActionButton(text = 'Search' , on_release = self.start_search))
    
    #method to display the cards related to our search input
    def please_search(self, *args):
        if self.sb.state is 'down' :
            self.manager.cb_display_cards('search' , self.manager.mainbutton , self.sinput.text)
            self.sb.state = 'normal'
Example #8
0
    def build(self):

        eylemcubugu = ActionBar(pos_hint={'top': 1})

        eylemgorunumu = ActionView()
        eylemcubugu.add_widget(eylemgorunumu)

        #oncekieylem=ActionPrevious(title='Eylem Çubuğu', app_icon='document-edit.png')
        #oncekieylem=ActionPrevious(title='Eylem Çubuğu', app_icon='atlas://data/images/defaulttheme/close')
        oncekieylem = ActionPrevious(title='Eylem Çubuğu',
                                     app_icon='atlas://atlasim/document-edit')
        eylemgorunumu.add_widget(oncekieylem)

        aksiyondugmesi2 = ActionButton(icon='atlas://atlasim/document-open')
        eylemgorunumu.add_widget(aksiyondugmesi2)

        aksiyondugmesi1 = ActionButton(icon='atlas://atlasim/document-save')
        eylemgorunumu.add_widget(aksiyondugmesi1)

        aksiyondugmesi4 = ActionButton(icon='atlas://atlasim/document-save-as')
        eylemgorunumu.add_widget(aksiyondugmesi4)

        aksiyondugmesi3 = ActionButton(icon='atlas://atlasim/document-new')
        eylemgorunumu.add_widget(aksiyondugmesi3)

        aksiyondugmesi5 = ActionButton(icon='atlas://atlasim/application-exit')
        eylemgorunumu.add_widget(aksiyondugmesi5)

        duzen = BoxLayout(orientation='vertical')
        duzen.add_widget(eylemcubugu)

        self.etiket = Label(text="Ana Alan")
        duzen.add_widget(self.etiket)

        return duzen
    def __init__(self, **kvargs):
        super().__init__(**kvargs)
        self.action_view = self.ids.action_view
        self.screen_manager = self.ids.screen_manager
        self.action_previous = self.ids.action_previous

        for item_name in self.buttons_group:  # кнопки спинера
            item_button = ActionButton(
                text=item_name, id=item_name, on_press=self.events_screen,
                on_release=lambda *args: self.ids.action_overflow._dropdown.select(
                    self.on_release_select_item_spinner()))
            self.ids.action_overflow.add_widget(item_button)

        for path_image in self.buttons_menu:  # кнопки меню
            name_image = os.path.split(path_image)[1].split('.')[0]
            text_name_button = self.name_buttons_menu[name_image]

            action_group = ActionGroup(text=text_name_button)
            #button_menu = \
            #    ActionButton(text=text_name_button, icon=path_image,
            #                 id=name_image, on_press=self.events_screen)
            button_menu = \
                ActionButton(icon=path_image, id=name_image, on_press=self.events_screen)
            action_group.add_widget(button_menu)
            self.ids.action_view.add_widget(action_group)
Example #10
0
    def __init__(self):

        actionview = ActionView()
        actionview.use_separator = True
        ap = ActionPrevious(title='Action Bar', with_previous=False)
        actionview.add_widget(ap)
        self.abtn1 = ActionButton(text="Btn1")
        self.abtn1.bind(on_press=self.ActionBtn1Callback)
        actionview.add_widget(self.abtn1)
        self.abtn2 = ActionButton(text="Btn2")
        self.abtn2.bind(on_press=self.ActionBtn2Callback)
        actionview.add_widget(self.abtn2)

        self.abtn3 = ActionButton(text="Btn3", icon="images.jpg")
        self.abtn3.bind(on_press=self.ActionBtn3Callback)
        actionview.add_widget(self.abtn3)

        group1 = ActionGroup()

        self.abtn4 = ActionButton(text="Btn4")
        self.abtn4.bind(on_press=self.ActionBtn4Callback)
        group1.add_widget(self.abtn4)

        self.abtn5 = ActionButton(text="Press Me!!!!")
        self.abtn5.bind(on_press=self.ActionBtn5Callback)
        group1.add_widget(self.abtn5)

        actionview.add_widget(group1)

        self.actionbar = ActionBar()
        self.actionbar.add_widget(actionview)
Example #11
0
 def _fill_action_bar(self):
     """create the action_bar and add screens as tabs"""
     self.tabs = []
     for screen in [s for s in self.screens if s != 'no_screens_label']:
         tab = ActionButton(text=screen)
         self.action_view.add_widget(tab, 1)
         tab.bind(on_release=self._on_tab)
         self.tabs.append(tab)
Example #12
0
 def dataChanged(self, instance, value):
     """"called when some part of the data is changed. So we can show the edit buttons"""
     if not self.isChanged and not self.isLoading:
         btn = ActionButton(text = 'V', on_press=self.sendSettingsToDevice)
         self.editbar.add_widget(btn, 1)
         self.editButtons.append(btn)
         btn = ActionButton(text = 'X', on_press=self.undoEdit)
         self.editbar.add_widget(btn, 1)
         self.editButtons.append(btn)
         self.isChanged = True
Example #13
0
class GraphView(BoxLayout):
    def __init__(self, **kwargs):
        super(GraphView, self).__init__(orientation='vertical')
        self.label = Label(text="Please slide the slider")
        self.add_widget(self.label)
        self.slider = Slider(min=-2, max=2, value=1)
        self.slider.bind(value=self.SliderCallback)
        self.add_widget(self.slider)
        self.add_widget(self.graph_plot_sample(self.slider.value))
        actionview = ActionView()
        actionview.use_separator = True
        ap = ActionPrevious(title='Dawot', with_previous=False)
        actionview.add_widget(ap)
        self.abtn1 = ActionButton(text="File")
        self.abtn1.bind(on_press=self.ActionBtn1Callback)
        actionview.add_widget(self.abtn1)
        self.abtn2 = ActionButton(text="Plot")
        self.abtn2.bind(on_press=self.ActionBtn2Callback)
        actionview.add_widget(self.abtn2)
        self.actionbar = ActionBar()
        self.actionbar.add_widget(actionview)
        self.add_widget(self.actionbar)

    def SliderCallback(self, instance, value):
        self.label.text = str(value)

    def ActionBtn1Callback(self, instance):
        root = tkinter.Tk()
        root.withdraw()
        fTyp = [("", "*")]
        iDir = os.path.abspath(os.path.dirname(__file__))
        file = tkinter.filedialog.askopenfilename(filetypes=fTyp,
                                                  initialdir=iDir)
        tkinter.messagebox.showinfo('Input file', file)

    def ActionBtn2Callback(self, instance):
        self.graph_plot_sample(self.slider.value)

    def graph_plot_sample(self, value):
        fig, ax = pl.subplots()
        x = np.linspace(-np.pi, np.pi)
        print(type(value))
        print(value)
        y = np.sin(x * float(value))
        #y = np.sin(x*2.0)
        ax.set_xlabel("X label")
        ax.set_ylabel("Y label")
        ax.grid(True)
        ax.plot(x, y)
        pl.draw()
        fig.canvas.draw()
        return fig.canvas
 def start_search(self, *args):
     #remove the 'search' button we had in the actionbar
     self.ids.av.remove_widget(self.ids.av.children[0])
     #creating the search textinput (presstextinput) and the exit button(recreates the initial actionbar)
     self.sinput = ActionText(font_size = 25, padding_y = [10,0])
     self.sinput.multiline = False
     self.sb = ActionButton (text = 'X',on_release = self.close)
     #bind the search presstextinput and our exit button
     self.sinput.my_button = self.sb
     self.ids.av.add_widget(self.sinput)
     self.ids.av.add_widget(self.sb)
     #the exit button is also our search button so we bind its state
     self.sb.bind(state = self.please_search)
class RootWidget(BoxLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs, orientation='vertical')
        self.legacy = Legacy()
        self.actionbar = ActionBar(pos_hint={'top': 1})
        self.av = av = ActionView()
        av.add_widget(ActionPrevious(title='', with_previous=False))
        av.add_widget(ActionOverflow())
        backbutton = ActionButton(text='Back')
        av.add_widget(backbutton)
        backbutton.bind(on_press=(self.back))
        self.nextbutton = ActionButton(text='Next')
        av.add_widget(self.nextbutton)
        self.nextbutton.bind(on_press=(self.nextbtn))
        self.last_widget = self.monitor = Title(self)

        self.actionbar.add_widget(av)

        # can't be set in F.ActionView() -- seems like a bug
        av.use_separator = True
        self.add_widget(self.actionbar)
        self.add_widget(self.monitor)
        self.av = av


    def next_visible(self, visible=True):
        try:
            if visible:
                self.av.add_widget(self.nextbutton)
            else:
                self.av.remove_widget(self.nextbutton)
        except WidgetException:
            pass

    def back(self, _):
        self.next_visible(True)
        self.remove_widget(self.monitor)
        self.monitor = self.last_widget
        self.add_widget(self.monitor)

    def nextbtn(self, _):
        self.last_widget = self.monitor
        self.remove_widget(self.monitor)
        self.monitor = self.monitor.next()
        self.add_widget(self.monitor)

    def callnext(self, next):
        self.last_widget = self.monitor
        self.remove_widget(self.monitor)
        self.monitor = next
        self.add_widget(self.monitor)
    def show_find(self, show):
        '''Adds the find button
        '''
        if self.action_btn_find is None:
            find = ActionButton(text='Find')
            find.bind(on_release=partial(self.dispatch, 'on_find'))
            self.action_btn_find = find

        if show:
            if not self.action_btn_find in self.children:
                self.add_widget(self.action_btn_find)
        else:
            if self.action_btn_find in self.children:
                self.remove_widget(self.action_btn_find)
Example #17
0
    def show_find(self, show):
        '''Adds the find button
        '''
        if self.action_btn_find is None:
            find = ActionButton(text='Find')
            find.bind(on_release=partial(self.dispatch, 'on_find'))
            self.action_btn_find = find

        if show:
            if not self.action_btn_find in self.children:
                self.add_widget(self.action_btn_find)
        else:
            if self.action_btn_find in self.children:
                self.remove_widget(self.action_btn_find)
Example #18
0
    def __init__(self, person, **kwargs):
        super(AppSwitcher, self).__init__ (**kwargs)
        def logout(instance):
            """ A callback function that calls the logoutUser method from masterControl. Is the event handler for the Sign Out button."""
            self.clear_widgets()
            self.parent.logoutUser()

        def editHandle(instance):
            """ A callback function that sets the current screen to the profile edit appelt. """
            print("In EditHandle")
            sm.current = 'prof'


        prof = ProfileManager(person, name = 'prof')

        bar = F.ActionBar(pos_hint={'top': 1})
        av = F.ActionView()

        av.add_widget(F.ActionPrevious(title='Dash', with_previous=False))
        av.add_widget(F.ActionOverflow())

        testButton = ActionButton(text = 'testButton')
        dd = ActionGroup(text = 'Applets', mode = 'spinner')
        dd.add_widget(testButton)
        av.add_widget(dd)

        userdd = ActionGroup(text='Welcome ' + person.m_name, mode = 'spinner')
        logoutButton = ActionButton(text = 'Sign Out')
        logoutButton.bind(on_release = logout)
        editProfileButton = ActionButton(text = 'Edit Profile')
        editProfileButton.bind(on_release = editHandle)
        userdd.add_widget(editProfileButton)
        userdd.add_widget(logoutButton)
        av.add_widget(userdd)

        bar.add_widget(av)
        av.use_separator = True
        self.add_widget(bar)

        sm = ScreenManager()

        screen = Screen(name='Screen')
        screen.add_widget(Label(text='Screen'))

        screen2 = Screen(name='Screen 2')
        screen2.add_widget(Label(text = 'Screen 2'))
        

        sm.add_widget(screen)
        sm.add_widget(screen2)
        sm.add_widget(prof)

        self.add_widget(sm)
Example #19
0
    def constroi_titulo(self):
        font_size = self.fonte_padrao
        bar = ActionBar()
        view = ActionView()
        btn_voltar = ActionPrevious(app_icon="./imagens/icone.png")
        btn_voltar.title = self.titulo.title()
        btn_voltar.size_hint = .8, .8

        view.add_widget(btn_voltar)
        titulo = btn_voltar.ids["title"]
        titulo.font_name = "Roboto"
        titulo.color = [
            0.9882352941176471, 0.6901960784313725, 0.00392156862745098, 1
        ]
        titulo.font_size = font_size * 1.3

        btn_ok = ActionButton(text="OK", font_size=font_size)

        view.add_widget(btn_ok)
        bar.add_widget(view)

        with view.canvas:
            Color(*get_color_from_hex("#040348"))
            Rectangle(size=(self.width * 3, self.height * 3))

        self.add_widget(bar)
        self.ids[f"{self.nome_tela}_botao_ok"] = btn_ok
        self.ids[f"{self.nome_tela}_botao_voltar"] = btn_voltar
    def constroi_titulo(self):
        font_size = self.fonte_padrao
        bar = ActionBar()
        view = ActionView()
        btn_voltar = ActionPrevious(app_icon="./imagens/icone.png")
        btn_voltar.size_hint = (.7, .7)
        btn_voltar.title = self.titulo.title()

        view.add_widget(btn_voltar)
        titulo = btn_voltar.ids["title"]
        titulo.font_name = "Roboto"
        titulo.color = [
            0.9882352941176471, 0.6901960784313725, 0.00392156862745098, 1
        ]
        titulo.font_size = font_size * 1.3

        btn_limpar = ActionButton(text="Limpar", font_size=font_size)
        #btn_limpar.on_release = self.button_limpa_db
        #print(btn_limpar.ids)

        with view.canvas:
            Color(*get_color_from_hex("#040348"))
            Rectangle(size=self.size)

        view.add_widget(btn_limpar)
        bar.add_widget(view)

        self.add_widget(bar)
        self.ids[f"historico_botao_limpar"] = btn_limpar
        self.ids[f"historico_botao_voltar"] = btn_voltar
 def _init_toolbar(self):
     '''A Toolbar is created with an ActionBar widget in which buttons are
        added with a specific behavior given by a callback. The buttons
        properties are given by matplotlib.
     '''
     basedir = os.path.join(rcParams['datapath'], 'images')
     actionview = ActionView()
     actionprevious = ActionPrevious(title="Navigation",
                                     with_previous=False)
     actionoverflow = ActionOverflow()
     actionview.add_widget(actionprevious)
     actionview.add_widget(actionoverflow)
     actionview.use_separator = True
     self.actionbar.add_widget(actionview)
     id_group = uuid.uuid4()
     for text, tooltip_text, image_file, callback in self.toolitems:
         if text is None:
             actionview.add_widget(ActionSeparator())
             continue
         fname = os.path.join(basedir, image_file + '.png')
         if text in ['Pan', 'Zoom']:
             action_button = ActionToggleButton(text=text,
                                                icon=fname,
                                                group=id_group)
         else:
             action_button = ActionButton(text=text, icon=fname)
         action_button.bind(on_press=getattr(self, callback))
         actionview.add_widget(action_button)
Example #22
0
    def __init__(self, app, **kwargs):
        """Constructor. Initialize the actionbar last after all other widgets.
           This widget depends on some functions from other widgets.

        Args:
            app - The application.

        Returns:
            NONE
        """
        #Actionbar initialization
        super(ActionBarWidget, self).__init__(pos_hint={'top': 1})
        action_view = ActionView()
        action_prev = ActionPrevious(with_previous=False,
                                     app_icon='icon.png',
                                     app_icon_height=actionbar_height / 2,
                                     app_icon_width=actionbar_height / 2)
        #Used to calculate direction vector to move window
        self.mouse_x = None
        self.mouse_y = None

        #Spinner initialization
        spinner = ActionGroup(mode='spinner', text='Select')
        grass = ActionButton(text='Grass cell',
                             on_press=lambda instance: app.map_gui.
                             enable_cell_colour(CellType.GRASS))
        prop = ActionButton(text='Prop cell',
                            on_press=lambda instance: app.map_gui.
                            enable_cell_colour(CellType.PROP))
        target = ActionButton(text='Target cell',
                              on_press=lambda instance: app.map_gui.
                              enable_cell_colour(CellType.TARGET))
        path = ActionButton(text='Path cell',
                            on_press=lambda instance: app.map_gui.
                            enable_cell_colour(CellType.PATH))
        spinner.add_widget(grass)
        spinner.add_widget(prop)
        spinner.add_widget(target)
        spinner.add_widget(path)

        #Actionbar buttons
        Run = ActionButton(text='Run',
                           on_press=lambda instance: app.run_menu_popup.open())
        open = ActionButton(
            text='Open',
            on_press=lambda instance: app.file_chooser_popup.open())
        save = ActionButton(text='Save', on_press=app.serialize_map)
        clear = ActionButton(text='Clear', on_press=app.map_gui.clear_map)

        #Add widgets to actionbar
        action_view.add_widget(Run)
        action_view.add_widget(open)
        action_view.add_widget(save)
        action_view.add_widget(clear)
        action_view.add_widget(spinner)
        action_view.add_widget(action_prev)
        self.add_widget(action_view)
Example #23
0
def test_plugin(interval):
    action_view = app.start_screen.action_view
    item_button = \
        ActionButton(id='plugins', on_press=events_screen,
                     icon='{}/Libs/Plugins/TestPlugin/button.png'.format(
                         app.directory))
    action_view.add_widget(item_button, index=-1)
    action_view.add_widget(ActionSeparator(), index=-1)
 def menu(self):
     action_previous = ActionPrevious(title='Taxi price',
                                      app_icon='image/taxi_logo_16.png',
                                      on_press=self.back,
                                      with_previous=self.with_previous)
     ag = ActionGroup(text='Menu', mode='spinner')
     for i in [('Рассчитать', self.countresult), ('Инфо', self.info),
               ('На главную', self.back), ('Выход', self.quit)]:
         bt = ActionButton(text=i[0])
         bt.bind(on_press=i[1])
         ag.add_widget(bt)
     aw = ActionView()
     aw.add_widget(ag)
     aw.add_widget(action_previous)
     menu = ActionBar()
     menu.add_widget(aw)
     self.add_widget(menu)
Example #25
0
    def show_action_btn_screen(self, show):
        if self.action_btn_next_screen:
            self.remove_widget(self.action_btn_next_screen)
        if self.action_btn_prev_screen:
            self.remove_widget(self.action_btn_prev_screen)

        self.action_btn_next_screen = None
        self.action_btn_prev_screen = None

        if show:
            self.action_btn_next_screen = ActionButton(text="Next Screen")
            self.action_btn_next_screen.bind(on_press=partial(self.dispatch, 'on_next_screen'))
            self.action_btn_prev_screen = ActionButton(text="Previous Screen")
            self.action_btn_prev_screen.bind(on_press=partial(self.dispatch, 'on_prev_screen'))

            self.add_widget(self.action_btn_next_screen)
            self.add_widget(self.action_btn_prev_screen)
Example #26
0
 def init_actionbar(self):
     self.actionItems = {
         'btn_refresh':
         ActionButton(id='ctx_1',
                      icon='theme/new/sync.png',
                      color=(.3, .3, .3),
                      on_release=self.refresh)
     }
     for item in self.actionItems:
         App.get_running_app().root.bar.children[0].add_widget(
             self.actionItems[item])
Example #27
0
    def __init__(self, *args, **kwargs):

        super().__init__(*args, **kwargs)
        self.orientation = "vertical"

        # Action bar (top)
        self.actionbar = ActionBar()
        self.actionview = ActionView()
        self.actionview.action_previous = ActionPrevious(
            with_previous=False, app_icon="res/appicon.png")
        actionbtn = ActionButton(text="Perfil",
                                 icon="res/profile.png",
                                 on_release=lambda _: App.get_running_app().
                                 go_screen(Screens.Profile.value))
        self.actionview.add_widget(actionbtn)
        actionbtn = ActionButton(text="Ajustes", icon="res/settings.png")
        self.actionview.add_widget(actionbtn)
        self.actionbar.add_widget(self.actionview)

        # Navigation bar (bottom)
        self.navigationbar = BoxLayout(orientation="horizontal",
                                       size_hint_y=None,
                                       height=dp(48),
                                       padding=dp(8))
        navbtn = ImageButton(source="res/search.png")
        navbtn.on_press = lambda: App.get_running_app().go_screen(Screens.
                                                                  Search.value)
        self.navigationbar.add_widget(navbtn)
        navbtn = ImageButton(source="res/home.png")
        navbtn.on_press = lambda: App.get_running_app().go_screen(Screens.Main.
                                                                  value)
        self.navigationbar.add_widget(navbtn)
        navbtn = ImageButton(source="res/message.png")
        navbtn.on_press = lambda: App.get_running_app().go_screen(
            Screens.Message.value)
        self.navigationbar.add_widget(navbtn)

        # Screen manager
        self.screenmanager = ScreenManager()
        self._load_screen_manager()
        self.add_widget(self.screenmanager)
Example #28
0
    def build(self):
        global MainSelectionTitle, GRID, BACKUP_GRID

        maze = self
        root = GridLayout(cols=1, rows=2, spacing=[1,
                                                   1])  # Root layout for app.
        actionbar = ActionBar(pos_hint={'top': 0})  # ActionBar for menu
        actionview = ActionView()

        ap2 = ActionPrevious(title='A*',
                             with_previous=False,
                             app_icon="icon_transparent.ico")
        actionview.add_widget(MainSelectionTitle)
        actionview.add_widget(ap2)

        start = ActionButton(text='Start', on_press=maze.Start)
        end = ActionButton(text='End', on_press=maze.End)
        search = ActionButton(text='Search', on_press=maze.Search)
        res = ActionButton(text='Restart', on_press=maze.Restart)

        actionview.add_widget(start)
        actionview.add_widget(end)
        actionview.add_widget(search)
        actionview.add_widget(res)

        actionbar.add_widget(actionview)
        root.add_widget(actionbar)

        layout = GridLayout(cols=self.cols, rows=self.rows,
                            spacing=[5, 5])  # Maze layout

        # Initializing maze
        for i in range(0, self.rows):
            for j in range(0, self.cols):
                node = Node(i, j)
                layout.add_widget(node)
                GRID[i][j] = node

        root.add_widget(layout)

        return root
Example #29
0
 def __init__(self, **kwargs):
     super(GraphView, self).__init__(orientation='vertical')
     self.label = Label(text="Please slide the slider")
     self.add_widget(self.label)
     self.slider = Slider(min=-2, max=2, value=1)
     self.slider.bind(value=self.SliderCallback)
     self.add_widget(self.slider)
     self.add_widget(self.graph_plot_sample(self.slider.value))
     actionview = ActionView()
     actionview.use_separator = True
     ap = ActionPrevious(title='Dawot', with_previous=False)
     actionview.add_widget(ap)
     self.abtn1 = ActionButton(text="File")
     self.abtn1.bind(on_press=self.ActionBtn1Callback)
     actionview.add_widget(self.abtn1)
     self.abtn2 = ActionButton(text="Plot")
     self.abtn2.bind(on_press=self.ActionBtn2Callback)
     actionview.add_widget(self.abtn2)
     self.actionbar = ActionBar()
     self.actionbar.add_widget(actionview)
     self.add_widget(self.actionbar)
				def _on_test_connect( self ) :
							"""

							:return:
							"""





							layout = self._add_console( '..mongo extended' , 'mongo extended info(from nmap)' )
							popup = screen.ConsolePopup( title='mongo connect' , content = layout )
							vx = popup.content.children[1].children[0]
							b = popup.content.children[4].children[0].children[0]
							b.text = 'test connect'
							b.bind( on_press = lambda a:self._show_info( vx ) )
							c = ActionButton( text = 'info' )
							c.bind( on_press = lambda a:self._show_extended_info( vx ) )
							popup.content.children[4].children[0].add_widget( c )

							popup.open()
Example #31
0
    def _set_menubar2(self, parent_widget):
        menu = ActionBar()
        parent_widget.add_widget(menu)
        self.menu = menu

        previous_button = ActionButton(text="Previous")
        action_view = ActionView(action_previous=previous_button)
        menu.add_widget(action_view)
        add_buttons = ActionDropDown()
        action_view.add_widget(add_buttons)

        self._set_add_buttons(add_buttons)
Example #32
0
 def init_actionbar(self):
     self.actionItems = {
         'btn_library':
         ActionButton(id='ctx_1',
                      icon='theme/books.png',
                      color=(.3, .3, .3),
                      on_release=lambda *x: App.get_running_app().
                      change_screen('Library'))
     }
     for item in self.actionItems:
         App.get_running_app().root.bar.children[0].add_widget(
             self.actionItems[item])
Example #33
0
    def build(self):

        eylemcubugu = ActionBar(pos_hint={'top': 1})

        eylemgorunumu = ActionView()
        eylemcubugu.add_widget(eylemgorunumu)

        oncekieylem = ActionPrevious(title='Eylem Çubuğu')
        eylemgorunumu.add_widget(oncekieylem)

        eylemdugmesi = ActionButton(text="Eylem Düğmesi")
        eylemgorunumu.add_widget(eylemdugmesi)
        eylemdugmesi.bind(on_press=self.dugmeyeTikla)

        duzen = BoxLayout(orientation='vertical')
        duzen.add_widget(eylemcubugu)

        self.etiket = Label(text="Ana Alan")
        duzen.add_widget(self.etiket)

        return duzen
Example #34
0
    def __init__(self, output_log):
        super(TaskBar, self).__init__(pos_hint={'top': 1})
        self.action_view = ActionView()
        self.action_view.add_widget(
            ActionPrevious(title='FTP Server', with_previous=False))
        # button to enter the start server setup
        self.start_server = ActionButton(text="Start Server",
                                         font_name='Arial')
        self.start_popup = ServerSetup(output_log)
        self.start_server.bind(on_press=self.start_popup.open)
        self.action_view.add_widget(self.start_server)

        self.database_button = ActionButton(text="Manage Database",
                                            font_name='Arial')
        self.database_popup = Popup(title='Manage Database',
                                    content=DatabaseManageContent(),
                                    size_hint=(0.9, 0.8))
        self.database_button.bind(on_press=self.database_popup.open)
        self.action_view.add_widget(self.database_button)

        self.add_widget(self.action_view)
Example #35
0
 def gen_actionbar(self):
     self.davbar = ReadyActionBar()
     self.actionview = self.davbar.actview
     self.levelup = ActionButton(
         on_press=hide_keyboard,
         on_release=self.on_levelup,
         icon="atlas://data/images/defaulttheme/levelup",
         text="One level up")
     self.edit = ActionButton(on_press=hide_keyboard,
                              on_release=self.on_edit,
                              icon="atlas://data/images/defaulttheme/edit",
                              text="Edit path")
     self.newdir = ActionButton(
         on_press=hide_keyboard,
         on_release=self.on_newdir,
         icon="atlas://data/images/defaulttheme/newdir",
         text="New folder")
     self.actionview.add_widget(self.levelup)
     self.actionview.add_widget(self.newdir)
     self.actionview.add_widget(self.edit)
     self.add_widget(self.davbar, len(self.children))
Example #36
0
    def show_action_btn_screen(self, show):
        '''To add action_btn_next_screen and action_btn_prev_screen
           if show is True. Otherwise not.
        '''
        if self.action_btn_next_screen:
            self.remove_widget(self.action_btn_next_screen)
        if self.action_btn_prev_screen:
            self.remove_widget(self.action_btn_prev_screen)

        self.action_btn_next_screen = None
        self.action_btn_prev_screen = None

        if show:
            self.action_btn_next_screen = ActionButton(text="Next Screen")
            self.action_btn_next_screen.bind(
                on_press=partial(self.dispatch, 'on_next_screen'))
            self.action_btn_prev_screen = ActionButton(text="Previous Screen")
            self.action_btn_prev_screen.bind(
                on_press=partial(self.dispatch, 'on_prev_screen'))

            self.add_widget(self.action_btn_next_screen)
            self.add_widget(self.action_btn_prev_screen)
Example #37
0
    def show_action_btn_screen(self, show):
        '''To add action_btn_next_screen and action_btn_prev_screen
           if show is True. Otherwise not.
        '''
        if self.action_btn_next_screen:
            self.remove_widget(self.action_btn_next_screen)
        if self.action_btn_prev_screen:
            self.remove_widget(self.action_btn_prev_screen)

        self.action_btn_next_screen = None
        self.action_btn_prev_screen = None

        if show:
            self.action_btn_next_screen = ActionButton(text="Next Screen")
            self.action_btn_next_screen.bind(
                on_press=partial(self.dispatch, 'on_next_screen'))
            self.action_btn_prev_screen = ActionButton(text="Previous Screen")
            self.action_btn_prev_screen.bind(
                on_press=partial(self.dispatch, 'on_prev_screen'))

            self.add_widget(self.action_btn_next_screen)
            self.add_widget(self.action_btn_prev_screen)
Example #38
0
 def add_my_button(self, text, myaction, ag):
     b = ActionButton(text=text, markup = True, halign="center")
     b.bind (on_release=self.my_button_pressed)
     if myaction != None:
         b.myaction = myaction
     else:
         b.myaction = text            
     ag.add_widget(b)
Example #39
0
	def crear(self):
			for nom in getLugares():
				bt = ActionButton(text=nom)
				bt.bind(on_press=self.evt_origen)
				self.add_widget(bt)
class BattleScreen(Screen):
    def __init__(self, **kwargs):
        super(BattleScreen, self).__init__(**kwargs)

        self.bScene = BattleScene()
        self.layout = BoxLayout(orientation='vertical')
        self.actionBar = ActionBar()
        self.view = ActionView()
        self.prompt = self.bScene.getTurn()
        self.nametag = ActionPrevious(title=self.prompt)
        self.MoveButton = ActionButton(text='Move')
        self.AttackButton = ActionButton(text='Attack')
        self.AbilityButton = ActionButton(text='Item')
        self.ConfirmButton = ActionButton(text='Take Turn')
        self.MoveButton.bind(on_press=self.Move)
        self.AttackButton.bind(on_press=self.Action)
        self.AbilityButton.bind(on_press=self.Ability)
        self.ConfirmButton.bind(on_press=self.TakeTurn)
        self.battleLog = 'Now Beginning Battle...'
        self.label = ScrollableLabel(text=self.battleLog)
        self.layout.add_widget(self.actionBar)
        self.layout.add_widget(self.label)
        self.actionBar.add_widget(self.view)
        self.view.add_widget(self.nametag)
        self.view.add_widget(self.MoveButton)
        self.view.add_widget(self.AttackButton)
        self.view.add_widget(self.AbilityButton)
        self.view.add_widget(self.ConfirmButton)
        self.add_widget(self.layout)
        self.Target = Combatants.get(0)
        Combatants.checkItems(0)
        if Combatants.getHasItems(0) == False:
            self.AbilityButton.disabled = True

    def TakeTurn(self, obj):
        if isDM == True:
            if(Combatants.get(0).hasMoved == True and Combatants.get(0).hasActed == True):
                delay = 100
            elif(Combatants.get(0).hasMoved == False and Combatants.get(0).hasActed == False):
                delay = 60
            else:
                delay = 80
            Combatants.get(0).CT -= delay
            Combatants.get(0).hasMoved = False
            Combatants.get(0).hasActed = False
            self.prompt = self.bScene.getTurn()
            self.nametag.title = self.prompt
        self.MoveButton.disabled = False
        self.AttackButton.disabled = False
        Combatants.checkItems(0)
        if Combatants.getHasItems(0) == True:
            self.AbilityButton.disabled = False
        else:
            self.AbilityButton.disabled = True

    def Move(self, obj):
        Combatants.get(0).hasMoved = True
        self.MoveButton.disabled = True

    def Action(self, obj):
        Screens[0].populate()
        self.manager.current = 'Action Menu'

    def Ability(self, obj):
        Screens[1].populateItems()
        Screens[1].populateTargs()
        self.manager.current = 'Ability Menu'

    def Attack(self):
        damage = Action.Attack(Combatants.get(0).acc, self.Target.eva, Combatants.get(0).attack, self.Target.defense)
        if(damage == -1):
            msg = "%s missed %s!" %(Combatants.get(0).name, self.Target.name)
            self.battleLog = self.battleLog + "\n" + msg
            self.label.text = self.battleLog
        else:
            msg = "%s hit %s for %d points of damage!" %(Combatants.get(0).name, self.Target.name, damage)
            self.battleLog = self.battleLog + "\n" + msg
            self.label.text = self.battleLog
            self.Target.HP -= damage
            if(self.Target.HP <= 0):
                msg = "%s was defeated!" %(self.Target.name)
                self.battleLog = self.battleLog + "\n" + msg
                self.label.text = self.battleLog

    def UseItem(self, num):
        Combatants.get(0).inventory[num].quantity -= 1
        methodToCall = getattr(Item, Combatants.get(0).inventory[num].name)
        msg = methodToCall(self.Target)
        self.battleLog = self.battleLog + "\n" + msg
        self.label.text = self.battleLog
Example #41
0
class EditContView(ContextualActionView):
    '''EditContView is a ContextualActionView, used to display Edit items:
       Copy, Cut, Paste, Undo, Redo, Select All, Add Custom Widget. It has
       events:
       on_undo, emitted when Undo ActionButton is clicked.
       on_redo, emitted when Redo ActionButton is clicked.
       on_cut, emitted when Cut ActionButton is clicked.
       on_copy, emitted when Copy ActionButton is clicked.
       on_paste, emitted when Paste ActionButton is clicked.
       on_delete, emitted when Delete ActionButton is clicked.
       on_selectall, emitted when Select All ActionButton is clicked.
       on_add_custom, emitted when Add Custom ActionButton is clicked.
    '''

    __events__ = ('on_undo', 'on_redo', 'on_cut', 'on_copy',
                  'on_paste', 'on_delete', 'on_selectall',
                  'on_next_screen', 'on_prev_screen')
    
    action_btn_next_screen = ObjectProperty(None, allownone=True)
    action_btn_prev_screen = ObjectProperty(None, allownone=True)

    def show_action_btn_screen(self, show):
        if self.action_btn_next_screen:
            self.remove_widget(self.action_btn_next_screen)
        if self.action_btn_prev_screen:
            self.remove_widget(self.action_btn_prev_screen)

        self.action_btn_next_screen = None
        self.action_btn_prev_screen = None

        if show:
            self.action_btn_next_screen = ActionButton(text="Next Screen")
            self.action_btn_next_screen.bind(on_press=partial(self.dispatch, 'on_next_screen'))
            self.action_btn_prev_screen = ActionButton(text="Previous Screen")
            self.action_btn_prev_screen.bind(on_press=partial(self.dispatch, 'on_prev_screen'))

            self.add_widget(self.action_btn_next_screen)
            self.add_widget(self.action_btn_prev_screen)

    def on_undo(self, *args):
        pass

    def on_redo(self, *args):
        pass

    def on_cut(self, *args):
        pass

    def on_copy(self, *args):
        pass

    def on_paste(self, *args):
        pass

    def on_delete(self, *args):
        pass

    def on_selectall(self, *args):
        pass

    def on_next_screen(self, *args):
        pass

    def on_prev_screen(self, *args):
        pass