예제 #1
0
    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
예제 #2
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
예제 #3
0
    def gera_titulo(self):
        bar = ActionBar()
        view = ActionView()

        bnt_back = ActionPrevious(app_icon="./imagens/icone.png")
        bnt_back.size_hint = (.9, .9)
        bnt_back.title = "Cálculos"

        view.add_widget(bnt_back)
        bar.add_widget(view)

        self.add_widget(bar)
        self.ids["calculos_botao_voltar"] = bnt_back
예제 #4
0
    def __init__(self, **kwargs):
        super(CreateNew, self).__init__(**kwargs)
        self.name = 'createnew'
        self.key = 0
        self.stack = StackLayout(cols = 1,
                                 spacing=0,)

        #ActionBar
        self.actionbar = ActionBar(pos_hint={'top':1},
                                   background_color = (0.50,0.50,0.50,1),
                                   height = Window.height*.06,
                                   width = Window.width)
        self.actionview = ActionView()
        self.actionbar.add_widget(self.actionview)
        self.actionprevious = ActionPrevious(with_previous=True,
                                        app_icon = 'mylogo.png',
                                        previous_image = 'arrow.png',
                                        title = '')
        self.actionview.add_widget(self.actionprevious)

        self._savebutton = SaveButton()
        self.savebutton = self._savebutton.button
        self.actionview.add_widget(self._savebutton)
        self.stack.add_widget(self.actionbar)
        self.scroll = Text()
        self.txt = self.scroll.children[0]
        # self.txt = TextInput(size_hint=(1, .92),
        #                  pos_hint={'center_x': .5,'center_y': .46},
        #                      font_size = '35sp')
        self.stack.add_widget(self.scroll)

        self.dropdown = drop()
        self.actionview.add_widget(self.dropdown._main, -1)
        self.add_widget(self.stack)
예제 #5
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)
 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)
예제 #7
0
파일: main-2.py 프로젝트: stdgn/kivy-tr
    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
예제 #8
0
    def __init__(self, **kwargs):
        super(NoteScreen, self).__init__(**kwargs)
        self.name = 'notescreen'
        self.box = StackLayout(
            cols=1,
            spacing=0,
        )

        #Actionbar
        self.actionbar = ActionBar(pos_hint={'top': 1},
                                   background_color=(0.50, 0.50, 0.50, 1),
                                   height=Window.height * .06,
                                   width=Window.width)
        self.actionview = ActionView()
        self.actionbar.add_widget(self.actionview)
        self.actionprevious = ActionPrevious(with_previous=True,
                                             app_icon='mylogo.png',
                                             previous_image='arrow.png',
                                             title='')
        self._update_button = UpdateButton()
        self.update_button = self._update_button.button
        self._delete_button = DeleteButton()
        self.delete_button = self._delete_button.button
        self.actionview.add_widget(self._update_button)
        self.actionview.add_widget(self._delete_button)
        self.actionview.add_widget(self.actionprevious)
        self.scroll = Text2()
        self.txt = self.scroll.children[0]

        self.box.add_widget(self.actionbar)
        self.box.add_widget(self.scroll)

        self.add_widget(self.box)
        self.dropdown = drop()
        self.actionview.add_widget(self.dropdown._main, -2)
예제 #9
0
파일: gui.py 프로젝트: tkyc/pkmn_mmo_bot
    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)
예제 #10
0
    def __init__(self, **kwargs):
        super(Notes, self).__init__(**kwargs)
        self.name = 'notes'
        self.stackcon = StackLayout(cols = 1,
                                    spacing=0,)

        #Actionbar
        self.actionbar = ActionBar(background_color = (0.50,0.50,0.50,1),
                                   pos_hint={'top':1},
                                   height = Window.height*.06,
                                   width = Window.width)

        self.actionview = ActionView()
        self.actionprevious = ActionPrevious(with_previous=False,
                                        app_icon = 'icon.png',
                                        previous_image = '',
                                        title = '')


        self._addnotebutton = AddNew()
        self.addnotebutton = self._addnotebutton.button
        self.stack = GridLayout(cols = 1,
                               spacing=0,
                               size_hint_y=None)

        self.scroll = ScrollView(size_hint=(1, None),
                                 size=(Window.width, Window.height-50))

        self.txt = Txt(text = '')

        self.close_button = CloseButton()
        self._search = SearchButton()
        self.search_button = self._search.button


        self.stack.bind(minimum_height=self.stack.setter('height'))


        self.actionbar.add_widget(self.actionview)
        self.actionview.add_widget(self.actionprevious)
        self.actionview.add_widget(self.txt)
        self.actionview.add_widget(self._search)
        self.actionview.add_widget(self._addnotebutton)

        self.stackcon.add_widget(self.actionbar)
        self.scroll.add_widget(self.stack)
        self.stackcon.add_widget(self.scroll)
        self.add_widget(self.stackcon)

        self.search_button.bind(on_release = self.hidetextbar)
        self.close_button.bind(on_release = self.showtextbar)
예제 #11
0
파일: myactionbar.py 프로젝트: iocafe/iocom
    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
 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)
예제 #13
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)
        
        duzen = BoxLayout(orientation='vertical')
        duzen.add_widget(eylemcubugu)

        self.etiket=Label(text="Ana Alan")
        duzen.add_widget(self.etiket)
        
        return duzen
예제 #14
0
    def build(self):

        layout = GridLayout(cols=4,
                            spacing=30,
                            padding=30,
                            row_default_height=150)
        ser_ports = serial_ports()

        self.label = Label(text=label_text)
        with layout.canvas.before:
            Color(.2, .2, .2, 1)
            self.rect = Rectangle(size=(1023, 840), pos=layout.pos)
        wimg = Image(source='logo.png')
        rSlider = Slider(orientation='vertical', min=0, max=255, value=r)
        gSlider = Slider(orientation='vertical', min=0, max=255, value=g)
        bSlider = Slider(orientation='vertical', min=0, max=255, value=b)
        btn = Button(text="Exit", size_hint_y=None, height=100)
        actionBar = ActionBar(size_hint_x=None, width=150)
        actionView = ActionView(
            action_previous=ActionPrevious(with_previous=False, ))
        actionBar.add_widget(actionView)
        for port in ser_ports:
            actionView.add_widget(
                ActionButton(text=port,
                             size_hint=(None, 1),
                             width=50,
                             on_release=self.call_back))

        btn.bind(on_press=self.exitApp)
        rSlider.bind(on_touch_move=self.update_r)
        gSlider.bind(on_touch_move=self.update_g)
        bSlider.bind(on_touch_move=self.update_b)

        layout.add_widget(wimg)
        layout.add_widget(rSlider)
        layout.add_widget(gSlider)
        layout.add_widget(bSlider)
        layout.add_widget(actionBar)
        layout.add_widget(btn)
        layout.add_widget(self.label)

        return layout
예제 #15
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
예제 #16
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)
예제 #17
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)
예제 #18
0
파일: main-son.py 프로젝트: stdgn/kivy-tr
    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
예제 #19
0
파일: gui.py 프로젝트: RonTamG/FTP-Server
    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)
예제 #20
0
    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
예제 #21
0
args = parser.parse_args()
sys.argv = [sys.argv[0]]

# IMPORTS
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.behaviors import ButtonBehavior
from kivy.lang import Builder
from kivy.graphics import Color, Rectangle, Line
from kivy.uix.actionbar import ActionBar, ActionView, ActionButton, ActionPrevious
import numpy as np

# Global variables
MainSelectionTitle = ActionPrevious(title='Selected: Road',
                                    with_previous=False,
                                    app_icon="icon_transparent.ico")
SELECTION = "r"
GRID = []  # Main grid for maze

# Maze's node template. Crates border for nodes.
Builder.load_string("""
<Node>:
    canvas.before:
        Color:
            rgba: .5, .5, .5, 0.6
        Line:
            width: 1
            rectangle: self.x, self.y, self.width, self.height
""")
예제 #22
0
    def __init__(self, **kwargs):
        super(MyPaintLayout, self).__init__(**kwargs)

        # 変数・設定
        self.orientation = 'vertical'
        self.pen_width_dropdown = PenWidthDropDown()

        # ウィジェットの定義
        self.paint = MyPaintWidget()
        self.action_bar = ActionBar()
        self.action_view = ActionView()
        self.action_previous = ActionPrevious()
        self.pen_preview = ActionPenPreview()

        # 戻る・やり直しボタン
        self.back_action_button = ActionButton(
            text='Back', on_press=lambda _: self.paint.back_action())

        self.redo_action_button = ActionButton(
            text='Redo', on_press=lambda _: self.paint.redo_action())

        # 色の決定用のモーダルウィンドウ
        self.pen_color_modal_view = ModalView(size_hint=(0.8, 0.8))
        self.clr_picker = ColorPicker(size_hint_y=9)
        self.clr_picker.bind(
            color=lambda _, color: self.change_pen_color(color))
        self.pen_color_modal_layout = BoxLayout(orientation='vertical')
        self.pen_color_modal_layout.add_widget(self.clr_picker)

        self.pen_color_modal_layout.add_widget(
            Button(text='Close',
                   on_press=self.pen_color_modal_view.dismiss,
                   size_hint_y=1))
        self.pen_color_modal_view.add_widget(self.pen_color_modal_layout)

        # 全消去用のモーダルウィンドウ
        self.clear_modal_view = ModalView(size_hint=(0.7, 0.7))
        self.clear_modal_layout = BoxLayout(orientation='vertical')
        self.clear_modal_layout.add_widget(
            Label(text='Do you really want to clear?'))
        self.clear_modal_layout.add_widget(
            Button(text='Yes',
                   on_press=lambda button: [
                       self.paint.canvas.clear(),
                       self.paint.back_redo_log.clear(),
                       self.clear_modal_view.dismiss()
                   ]))
        self.clear_modal_layout.add_widget(
            Button(text='No',
                   on_press=lambda button: self.clear_modal_view.dismiss()))
        self.clear_modal_view.add_widget(self.clear_modal_layout)

        # ペンの太さのモーダルウィンドウ
        self.pen_width_modal_view = ModalView(size_hint=(0.7, 0.5))
        self.pen_width_modal_layout = BoxLayout(orientation='vertical')
        self.pen_width_label = Label(text="Width: " +
                                     str(int(self.paint.current_width)))
        self.pen_width_slider = Slider(
            min=1,
            max=20,
            value=self.paint.current_width,
            step=1,
            on_touch_move=lambda x, y: self.change_pen_width(
                self.pen_width_slider.value))
        self.pen_width_modal_layout.add_widget(self.pen_width_label)
        self.pen_width_modal_layout.add_widget(self.pen_width_slider)
        self.pen_width_modal_layout.add_widget(
            Button(text='Close', on_press=self.pen_width_modal_view.dismiss))
        self.pen_width_modal_view.add_widget(self.pen_width_modal_layout)

        self.pen_color_btn = ActionButton(
            text='Color', on_press=lambda _: self.pen_color_modal_view.open())

        self.pen_width_btn = ActionButton(
            text='width: ' + str(int(self.paint.current_width)),
            on_press=self.pen_width_modal_view.open)
        self.clear_btn = ActionButton(text='Clear',
                                      on_press=self.clear_modal_view.open)

        # ウィジェットの配置
        self.action_view.add_widget(self.action_previous)
        self.action_view.add_widget(self.pen_preview)
        self.action_view.add_widget(self.back_action_button)
        self.action_view.add_widget(self.redo_action_button)
        self.action_view.add_widget(self.pen_color_btn)
        self.action_view.add_widget(self.pen_width_btn)
        self.action_view.add_widget(self.clear_btn)
        self.action_bar.add_widget(self.action_view)
        self.add_widget(self.paint)
        self.add_widget(self.action_bar)
예제 #23
0
파일: gui.py 프로젝트: jacky4566/ykpilot
    def loaderStep0(self):

        #self.s3dtextures = Screen3dtextures()
        #self.s3dtextures.setGui(self)
        #self.rl.ids.bl3dtextures.add_widget( self.s3dtextures.l )
        from sensors import sensors

        self.cDefVals = {
            'screenCurrent': 'Sensors',
            'totalUptime': 0,
            'totalMiles': 0.0,
            'apDirectionReverse': 0,
            'apDriver': 'driver9',
            'apCommunicationMode': "audio jack",
            'apWifiIp': '192.168.4.1'
        }

        for k in self.cDefVals.keys():
            try:
                print("config  			", k, " -- > ", self.config[k])
            except:
                print("config default - > no value [", k, "] setting [",
                      self.cDefVals[k], "]")
                self.config[k] = self.cDefVals[k]

        if self.virtualButtons:
            self.vBut = ScreenVirtualButtons(self)

        wfa = self.workingFolderAdress.split("/")
        dirName = wfa[-2]

        try:
            print("working folder adres ",
                  self.fa.mkDir(self.workingFolderAdress[:-1]))
        except:
            pass

        #self.tcp = helperTCP(ip)
        self.rl.passGuiApp(self)
        self.sen = sensors(self)
        self.sen.comCal.addCallBack(self.sen)

        #self.sen.run()
        """
		self.graph = Graph(xlabel='time', ylabel="angle", x_ticks_minor=1,
			ymax=1.0,ymin=0.0			
			)
		self.pPitch = MeshLinePlot(color=[1,1,0,1])
		self.pHeel = MeshLinePlot(color=[1,0,1,1])
		self.graph.add_plot(self.pPitch)
		self.graph.add_plot(self.pHeel)
		self.rl.ids.blModSimGra.add_widget(self.graph)

		self.graphGyro = Graph(xlabel='time', ylabel="gyro", x_ticks_minor=1,
			ymax=1.0,ymin=0.0			
			)
		self.pgx = MeshLinePlot(color=[1,1,0,1])
		self.pgy = MeshLinePlot(color=[1,0,1,1])
		self.pgz = MeshLinePlot(color=[1,0,0,1])
		self.graphGyro.add_plot(self.pgx)
		self.graphGyro.add_plot(self.pgy)
		self.graphGyro.add_plot(self.pgz)
		self.rl.ids.blModSimGra.add_widget(self.graphGyro)


		self.graphFFT = Graph(xlabel="Hz Heel", ylabel="Db Heel", ymax=1.0, ymin=0.0)
		self.pFFTHeel = MeshLinePlot(color=[1,0,0,1])
		self.pFFTPitch = MeshLinePlot(color=[0,1,0,1])
		self.pFFTUD = MeshLinePlot(color=[0,0,1,1])

		self.graphFFT.add_plot(self.pFFTHeel)
		self.graphFFT.add_plot(self.pFFTPitch)
		self.graphFFT.add_plot(self.pFFTUD)
		self.rl.ids.blModSimFFT.add_widget( self.graphFFT )

		self.compasGyro = Graph(xlabel='time', ylabel="compas", x_ticks_minor=1,
			ymax=1.0,ymin=0.0			
			)
		self.pc = MeshLinePlot(color=[1,1,0,1])
		self.compasGyro.add_plot(self.pc)
		self.rl.ids.blModSimGra.add_widget(self.compasGyro)

		self.graphMic = Graph(xlabel="Hz mic", ylabel="Db mic", ymax=1.0, ymin=0.0)
		self.pMic = MeshLinePlot(color=[1,0,0,1])
		self.pMic1 = MeshLinePlot(color=[0,1,0,1])
		self.pMic2 = MeshLinePlot(color=[0,0,1,1])
		self.graphMic.add_plot(self.pMic)
		self.graphMic.add_plot(self.pMic1)
		self.graphMic.add_plot(self.pMic2)
		self.rl.ids.blMicScre.add_widget(self.graphMic)
		"""

        #self.d3tex2 = d3tex2()
        #self.d3tex2.setGui(self)
        #self.rl.ids.bl3dtextures2.add_widget( self.d3tex2 )

        #action bar
        if True:
            self.mw = BoxLayout(orientation="vertical")
            self.ab = ActionBar()
            av = ActionView()
            self.ab.add_widget(av)
            ap = ActionPrevious(title="ykpilot",
                                with_previous=False,
                                app_icon="icons/ico_sailboat_256_256.png")
            ap.bind(on_release=self.screenChange)
            av.add_widget(ap)

            ao = ActionOverflow()
            ab = ActionButton(text="Sensors",
                              icon="icons/ico_find_256_256.png")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)
            ab = ActionButton(text="Model Screen",
                              icon="icons/ico_sailboat_256_256.png")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)
            ab = ActionButton(text="Simulator",
                              icon="icons/ico_sum_256_256.png")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            if self.virtualButtons:
                ab = ActionButton(text="Virtual Buttons",
                                  icon="icons/ico_in_256_256.png")
                ab.bind(on_release=self.screenChange)
                av.add_widget(ab)

            ab = ActionButton(text="Compass")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)
            """
			ab = ActionButton(text="3dtextures")
			ab.bind(on_release=self.screenChange)
			av.add_widget(ab)
			
			ab = ActionButton(text="3dtextures2")
			ab.bind(on_release=self.screenChange)
			av.add_widget(ab)
			"""

            ab = ActionButton(text="Race", icon="icons/ico_time_256_256.png")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            ab = ActionButton(text="Autopilot")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            ab = ActionButton(text="Mic Screen")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            ao = ActionOverflow()
            ab = ActionButton(text="Day")
            ab.bind(on_release=self.screenDay)
            av.add_widget(ab)
            ao = ActionOverflow()
            ab = ActionButton(text="Night")
            ab.bind(on_release=self.screenNight)
            av.add_widget(ab)

            ab = ActionButton(text="Widgets")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            #ab = ActionButton(text="MSM")
            #ab.bind(on_release=self.screenChange)
            #av.add_widget(ab)

            ab = ActionButton(text="NMEA multiplexer")
            ab.bind(on_release=self.screenChange)
            av.add_widget(ab)

            av.add_widget(ao)

            self.mw.add_widget(self.ab)
            try:
                rlParent = self.rl.parent
                rlParent.remove_widget(self.rl)

            except:
                print("rl. don't have parent !")
            self.mw.add_widget(self.rl)

            toreturn = self.mw
        else:
            toreturn = self.rl
        # actionbar

        #play from file
        toreturn = self.sen.buidPlayer(toreturn)
        #play from file

        #self.sWidgets.setUpGui()

        #self.ap.setupDriver()

        #Window.set_title("ykpilot")

        #self.ode = odeRTB(self)
        #self.sen.accel.addCallBack(self.ode)

        rlParent.add_widget(toreturn)
예제 #24
0
	def __init__(self, **kwargs):
		super(MainScreen, self).__init__(**kwargs)
	
		self.cols = 1
		self.rows = 1

		self._data_queue = queue.Queue()
		self.gps_location = None
		self.gps_status = None
		self.default_sensor = "Accelerometer"
		self.default_protocol = "terminal"
		self.default_server = "test.mosquitto.org"
		self.default_port = "1883"
		self.default_topic_url = "ie/dcu/ee513"

		#Layouts
		self._main_layout = BoxLayout(orientation='vertical', padding=0, size_hint=(1, 1))
		if (platform == 'android') or (platform == 'ios'):
			_terminal_layout = BoxLayout(orientation='vertical', padding=0, size_hint=(1, 0.7))
			_partition_layout = GridLayout(cols=2, rows=6, padding=0, size_hint=(1, 1), row_force_default=True, \
										rows_minimum={0: 150, 1: 150, 2: 150, 3: 150}, row_default_height=150, spacing=25)
		else:
			_terminal_layout = BoxLayout(orientation='vertical', padding=0, size_hint=(1, 0.4))
			_partition_layout = GridLayout(cols=2, rows=6, padding=0, size_hint=(1, 1), row_force_default=True, \
										rows_minimum={0: 50, 1: 50, 2: 50, 3: 50}, row_default_height=50, spacing=25)
  
		_action_previous = ActionPrevious(title='EE513 LABS', with_previous=False, app_icon='icons/sxmitter-logo-app-small.png', padding=0)
		_action_overflow = ActionOverflow()
		_action_view = ActionView(overflow_group=_action_overflow, use_separator=True)
		_action_button = ActionButton(text='debug')
		_action_overflow.add_widget(_action_button)
		_action_button_about = ActionButton(text='About')
		_action_button_about.bind(on_release=self._popup_about)
		_action_button_quit = ActionButton(text='Quit')
		_action_button_quit.bind(on_release=self.quitApp)
		_action_view.add_widget(_action_previous)
		_action_view.add_widget(_action_button_about)
		_action_view.add_widget(_action_button_quit)
		_action_view.add_widget(_action_overflow)
		_action_bar = ActionBar(pos_hint={'top': 1})
		_action_bar.add_widget(_action_view)

		_partition_layout.add_widget(Label(text='Server', size_hint_x=None, width=400))
		self._data_object["server"] = self.default_server
		self.server = TextInput(text='test.mosquitto.org', multiline=False, cursor_blink=True)
		self.server.bind(text=self.callback_server_text)
		_partition_layout.add_widget(self.server)
	
		_partition_layout.add_widget(Label(text='Port', size_hint_x=None, width=400))
		self._data_object["port"] = self.default_port
		self.port = TextInput(text='1883', multiline=False)
		self.port.bind(text=self.callback_port_text)
		_partition_layout.add_widget(self.port)

		_partition_layout.add_widget(Label(text='Sensor', size_hint_x=None, width=400))
		self._data_object["sensor"] = self.default_sensor
		sensor_spinner = Spinner(
					text=self.default_sensor,
					values=('Accelerometer', 'Compass', 'GPS', 'Barometer', 'Gravity', 'Gyroscope'),
					size_hint=(0.3, 0.5), sync_height=True)
		sensor_spinner.bind(text=self.callback_sensor_spinner_text)
		_partition_layout.add_widget(sensor_spinner)

		_partition_layout.add_widget(Label(text='Protocol', size_hint_x=None, width=400))
		self._data_object["protocol"] = self.default_protocol
		protocol_spinner = Spinner(
					text=self.default_protocol,
					values=('http', 'https', 'mqtt', 'udp', 'terminal'),
					size_hint=(0.3, 0.5), sync_height=True)
		protocol_spinner.bind(text=self.callback_protocol_spinner_text)
		_partition_layout.add_widget(protocol_spinner)

		_partition_layout.add_widget(Label(text='Topic/URL', size_hint_x=None, width=400))
		self._data_object["topic_url"] = self.default_topic_url
		self.topic_url = TextInput(text='ie/dcu/ee513', multiline=False)
		self.topic_url.bind(text=self.callback_topic_url_text)
		_partition_layout.add_widget(self.topic_url)
  
		_partition_layout.add_widget(Label(text='Connect', size_hint_x=None, width=400))
		switch = Switch()
		switch.bind(active=self.callback_switch)
		_partition_layout.add_widget(switch)

		self.terminal = TextInput(text='Terminal output...', multiline=True, readonly=False, size_hint=(1, 1))
		self.global_terminal = self.terminal
		_terminal_layout.add_widget(self.terminal)		
		
		self._main_layout.add_widget(_action_bar)
		self._main_layout.add_widget(_partition_layout)
		self._main_layout.add_widget(_terminal_layout)
		self.add_widget(self._main_layout)