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 #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)
Example #3
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 #4
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 #5
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 #6
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
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)
Example #8
0
class MyActionBar():
    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 ActionBtn1Callback(self,instance):
        print("Btn1 press!!")

    def ActionBtn2Callback(self,instance):
        print("Btn2 press!!")

    def ActionBtn3Callback(self,instance):
        print("Btn3 press!!")

    def ActionBtn4Callback(self,instance):
        print("Btn4 press!!")

    def ActionBtn5Callback(self,instance):
        print("Btn5 press!!")
Example #9
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)
    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 #11
0
class MyActionBar():
    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 ActionBtn1Callback(self, instance):
        print("Btn1 press!!")

    def ActionBtn2Callback(self, instance):
        print("Btn2 press!!")

    def ActionBtn3Callback(self, instance):
        print("Btn3 press!!")

    def ActionBtn4Callback(self, instance):
        print("Btn4 press!!")

    def ActionBtn5Callback(self, instance):
        print("Btn5 press!!")
 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)
				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 #14
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 #15
0
class TaskBar(ActionBar):
    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)
    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
Example #17
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.
       on_find, emitted when Find ActionButton is clicked.
    '''

    __events__ = ('on_undo', 'on_redo', 'on_cut', 'on_copy', 'on_paste',
                  'on_delete', 'on_selectall', 'on_next_screen',
                  'on_prev_screen', 'on_find')

    action_btn_next_screen = ObjectProperty(None, allownone=True)
    action_btn_prev_screen = ObjectProperty(None, allownone=True)
    action_btn_find = ObjectProperty(None, allownone=True)

    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)

    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)

    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

    def on_find(self, *args):
        pass
Example #18
0
	def crear(self):
			for nom in getLugares():
				bt = ActionButton(text=nom)
				bt.bind(on_press=self.evt_origen)
				self.add_widget(bt)
Example #19
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 #21
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
Example #22
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)
Example #23
0
    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)