Esempio n. 1
0
    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)
Esempio n. 2
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)
Esempio n. 3
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)
Esempio n. 4
0
    def __init__(self, **kvargs):
        super(StartScreen, self).__init__(**kvargs)
        self.mobile_client_label = self.ids.mobile_client_label
        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)
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
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)
 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)
Esempio n. 9
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)
Esempio n. 10
0
    def create_my_action_bar(self):
        self.clear_widgets()
        av = ActionView()
        self.my_action_view = av
        ap = ActionPrevious(title='my action bar', with_previous=False)
        av.add_widget(ap)

        av.add_widget(ActionOverflow())
        # av.add_widget(ActionButton(text='btn0', 
        #       icon='atlas://data/images/defaulttheme/audio-volume-high'))

        ap.title = "i-spy"

        n_devices = len(self.devices);
        if n_devices > 0:
            ag = ActionGroup(text='window')
            self.add_my_button('signals', None, ag)
            self.add_my_button('memory', None, ag)
            self.add_my_button('configure', None, ag)
            self.add_my_button('program', None, ag)
            av.add_widget(ag)

            ag = ActionGroup(text='devices')
            for d in self.devices:
                s = d.split('.', 1)
                txt = s[0] + '[size=14]\n[color=9090FF]' + s[1] + '[/color][/size]'
                self.add_my_button(txt, d, ag)
            av.add_widget(ag)

        ag = ActionGroup(text='i-spy')
        self.add_my_button('disconnect', None, ag)
        self.add_my_button('close', None, ag)
        av.add_widget(ag)

        self.add_widget(av)
        av.use_separator = True
Esempio n. 11
0
class KKFileChooser(BoxLayout):
    filename = StringProperty("")
    chooser = ObjectProperty(None, allownone=True)
    path = StringProperty(home)
    thumbs = DictProperty({})

    def __init__(self, **kwargs):
        super(KKFileChooser, self).__init__(**kwargs)
        self.orientation = "vertical"
        self.spacing = "5dp"
        self.chooser = FileChooserArtView(path=self.path, _thumbs=self.thumbs)
        self.chooser.bind(selection=self.on_file_select,
                          path=self.setter("path"),
                          _thumbs=self.setter("thumbs"))
        self.fileentry = TextInput(size_hint_y=None,
                                   height="30dp",
                                   text=self.filename,
                                   multiline=False)
        self.fileentry.bind(text=self.setter("filename"))

        self.gen_actionbar()

        self.chooser.bind(path=self.on_path)
        self.on_path(None, self.path)

        self.add_widget(self.fileentry)
        self.add_widget(self.chooser)

    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))

    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)

    def on_levelup(self, *args):
        #print "levelup", os.sep.join(self.chooser.path.split(os.sep)[:-1]), self.chooser.path
        newpath = os.sep.join(self.chooser.path.split(os.sep)[:-1])
        if newpath == "":
            newpath = os.sep
        self.chooser.path = newpath

    def on_edit(self, *args):
        content = BoxLayout(orientation="vertical", spacing="5dp")
        self.popup = Popup(size_hint=(.5, .3),
                           content=content,
                           title="Insert custom path")
        buttonbox = BoxLayout(orientation="horizontal",
                              spacing="5dp",
                              height=45)
        ok = Button(text="OK",
                    on_press=hide_keyboard,
                    on_release=self.cd,
                    height=40,
                    size_hint_y=None)
        cancel = Button(text="Cancel",
                        on_press=hide_keyboard,
                        on_release=self.popup.dismiss,
                        height=40,
                        size_hint_y=None)
        buttonbox.add_widget(ok)
        buttonbox.add_widget(cancel)
        self.direrror = Label(markup=True, text="")
        self.direntry = TextInput(height=30,
                                  size_hint_y=None,
                                  on_text_validate=self.cd,
                                  multiline=False,
                                  focus=True)
        content.add_widget(self.direrror)
        content.add_widget(self.direntry)
        content.add_widget(Widget())
        content.add_widget(buttonbox)
        self.popup.open()

    def on_newdir(self, *args):
        content = BoxLayout(orientation="vertical", spacing="5dp")
        self.popup = Popup(size_hint=(.5, .3),
                           content=content,
                           title="New folder")
        buttonbox = BoxLayout(orientation="horizontal",
                              spacing="5dp",
                              height=45)
        ok = Button(text="OK",
                    on_press=hide_keyboard,
                    on_release=self.mkdir,
                    height=40,
                    size_hint_y=None)
        cancel = Button(text="Cancel",
                        on_press=hide_keyboard,
                        on_release=self.popup.dismiss,
                        height=40,
                        size_hint_y=None)
        buttonbox.add_widget(ok)
        buttonbox.add_widget(cancel)
        self.direrror = Label(markup=True, text="")
        self.direntry = TextInput(height=30,
                                  size_hint_y=None,
                                  on_text_validate=self.mkdir,
                                  multiline=False,
                                  focus=True)
        content.add_widget(self.direrror)
        content.add_widget(self.direntry)
        content.add_widget(Widget())
        content.add_widget(buttonbox)
        self.popup.open()

    def mkdir(self, *args):
        #print "mkdir", join(self.chooser.path, self.direntry.text)
        try:
            os.mkdir(join(self.chooser.path, self.direntry.text))
            # This should make the view refresh
            self.chooser.path = os.sep + self.chooser.path[:]
            self.popup.dismiss()
        except OSError, error:
            self.direrror.text = str(error)
Esempio n. 12
0
class KKFileChooser(BoxLayout):
    filename = StringProperty("")
    chooser = ObjectProperty(None, allownone=True)
    path = StringProperty(home)
    thumbs = DictProperty({})

    def __init__(self, **kwargs):
        super(KKFileChooser, self).__init__(**kwargs)
        self.orientation = "vertical"
        self.spacing = "5dp"
        self.chooser = FileChooserArtView(path=self.path, _thumbs=self.thumbs)
        self.chooser.bind(selection=self.on_file_select, path=self.setter("path"), _thumbs=self.setter("thumbs"))
        self.fileentry = TextInput(size_hint_y=None, height="30dp", text=self.filename, multiline=False)
        self.fileentry.bind(text=self.setter("filename"))

        self.gen_actionbar()

        self.chooser.bind(path=self.on_path)
        self.on_path(None, self.path)

        self.add_widget(self.fileentry)
        self.add_widget(self.chooser)


    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))

    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)

    def on_levelup(self, *args):
        #print "levelup", os.sep.join(self.chooser.path.split(os.sep)[:-1]), self.chooser.path
        newpath = os.sep.join(self.chooser.path.split(os.sep)[:-1])
        if newpath == "":
            newpath = os.sep
        self.chooser.path = newpath

    def on_edit(self, *args):
        content = BoxLayout(orientation="vertical", spacing="5dp")
        self.popup = Popup(size_hint=(.5, .3), content=content, title="Insert custom path")
        buttonbox = BoxLayout(orientation="horizontal", spacing="5dp", height=45)
        ok = Button(text="OK", on_press=hide_keyboard, on_release=self.cd, height=40, size_hint_y=None)
        cancel = Button(text="Cancel", on_press=hide_keyboard, on_release=self.popup.dismiss, height=40, size_hint_y=None)
        buttonbox.add_widget(ok)
        buttonbox.add_widget(cancel)
        self.direrror = Label(markup=True, text="")
        self.direntry = TextInput(height=30, size_hint_y=None, on_text_validate=self.cd, multiline=False, focus=True)
        content.add_widget(self.direrror)
        content.add_widget(self.direntry)
        content.add_widget(Widget())
        content.add_widget(buttonbox)
        self.popup.open()

    def on_newdir(self, *args):
        content = BoxLayout(orientation="vertical", spacing="5dp")
        self.popup = Popup(size_hint=(.5, .3), content=content, title="New folder")
        buttonbox = BoxLayout(orientation="horizontal", spacing="5dp", height=45)
        ok = Button(text="OK", on_press=hide_keyboard, on_release=self.mkdir, height=40, size_hint_y=None)
        cancel = Button(text="Cancel", on_press=hide_keyboard, on_release=self.popup.dismiss, height=40, size_hint_y=None)
        buttonbox.add_widget(ok)
        buttonbox.add_widget(cancel)
        self.direrror = Label(markup=True, text="")
        self.direntry = TextInput(height=30, size_hint_y=None, on_text_validate=self.mkdir, multiline=False, focus=True)
        content.add_widget(self.direrror)
        content.add_widget(self.direntry)
        content.add_widget(Widget())
        content.add_widget(buttonbox)
        self.popup.open()

    def mkdir(self, *args):
        #print "mkdir", join(self.chooser.path, self.direntry.text)
        try:
            os.mkdir(join(self.chooser.path, self.direntry.text))
            # This should make the view refresh
            self.chooser.path = os.sep + self.chooser.path[:]
            self.popup.dismiss()
        except OSError, error:
            self.direrror.text = str(error)