Exemplo n.º 1
0
    def __init__(self, **kwargs):
        GridLayout.__init__(self)
        self.user = Admin()
        self.cols = 2  #important features-- represent no. of cols in screen
        #self.rows = 2 #use with care

        self.btn1 = Button(text="IR1", font_size=16)
        self.btn2 = Button(text="IR2", font_size=16)
        self.count = Label(text="Count = %d" % self.fetch_count())
        self.reset = Button(text="RESET", font_size=16)
        #self.status1 = Button (text = "status1")
        #self.status2 = Button (text = "status2")
        #self.cls.bind(on_press = self.clear_all)
        self.btn1.bind(
            on_press=lambda x: self.user.set_status("IR1", self.count))
        self.btn2.bind(
            on_press=lambda x: self.user.set_status("IR2", self.count))
        self.reset.bind(on_press=self.intial)
        #self.status1.bind(on_press = lambda x: self.user.set_ir("IR1"))
        #self.status2.bind(on_press = lambda x: self.user.set_ir("IR2"))

        self.add_widget(self.btn1)
        self.add_widget(self.btn2)
        #self.add_widget(self.status1)
        #self.add_widget(self.status2)
        self.add_widget(self.count)
        self.add_widget(self.reset)
Exemplo n.º 2
0
 def __init__(self, touch=None):
     GridLayout.__init__(self)
     self.clear_widgets()
     self.cols = 3  #משתנה זה שומר כמה עמודות ושורות היו על המסך שעלים ניתן להוסיף כפתורים
     self.depth = 0  #משתנה זה סופר כמה צעדים קדימה המחשב מחשב במהלך המחשחק
     for i in range(self.cols):  #לולאה זהו יוצרת את מסך התחלה
         for j in range(self.cols):
             if i < 2 and j in [0, 2]:
                 self.add_widget(Label())
             if i == 0 and j == 1:
                 self.add_widget(
                     Label(text='Ugolki',
                           font_size='50sp'))  #מוסיף כותרת למסך הפתיחה
             if i == 1 and j == 1:
                 button_rules = Button(text='Rules')
                 button_rules.bind(on_press=self.click_rules)
                 self.add_widget(
                     button_rules)  #מוסיף כפתור שמוביל למסך החוקים
             if i == 2 and j == 0:
                 button_easy = Button(text='Easy Difficulty')
                 button_easy.bind(on_press=self.game)
                 self.add_widget(
                     button_easy)  #מוסיף כפתור שמשנה את רמת הקושי של המשחק
             if i == 2 and j == 1:
                 button_medium = Button(text='Medium Difficulty')
                 button_medium.bind(on_press=self.game)
                 self.add_widget(button_medium
                                 )  #מוסיף כפתור שמשנה את רמת הקושי של המשחק
             if i == 2 and j == 2:
                 button_hard = Button(text='Hard Difficulty')
                 button_hard.bind(on_press=self.game)
                 self.add_widget(
                     button_hard)  #מוסיף כפתור שמשנה את רמת הקושי של המשחק
Exemplo n.º 3
0
    def __init__(self, **kwargs):
        GridLayout.__init__(self, **kwargs)
        self.buttons = []
        for i in range(1, 10):
            button = NumPadButton(text='{}'.format(i))
            button.bind(on_press=self.button_pressed)
            self.add_widget(button)
            self.buttons.append(button)

        self.enter_button = NumPadButton(text=u'\u2713', color=(0, 1, 0, 1))
        self.enter_button.bind(on_press=self.button_pressed)
        self.add_widget(self.enter_button)

        button = NumPadButton(text='0')
        button.bind(on_press=self.button_pressed)
        self.add_widget(button)
        self.buttons.append(button)

        self.decimal = NumPadButton(text='.')
        self.decimal.bind(on_press=self.button_pressed)

        self.backspace_button = NumPadButton(text=u'\u232b', color=(1, 0, 0, 1))
        self.backspace_button.bind(on_press=self.button_pressed)

        blayout = BoxLayout(orientation='horizontal')
        blayout.add_widget(self.decimal)
        blayout.add_widget(self.backspace_button)
        self.add_widget(blayout)
Exemplo n.º 4
0
    def __init__(self, val="(Set Command)"):
        GridLayout.__init__(self, cols=1, spacing=10, size_hint_y=None)
        self.bind(minimum_height=self.setter('height'))
        self.bind(pos=self.redraw, size=self.redraw)

        class MiniButton(BoxLayout):
            def __init__(self, widget):
                BoxLayout.__init__(self, size_hint_y=None, height=40)
                self.widget = widget
                self.add_widget(Label(size_hint_x=0.3))
                self.add_widget(self.widget)

        self.b_open = False
        self.main = Button(text=val, size_hint_y=None, height=40)
        self.main.bind(on_press=self.main_callback)
        self.add_widget(self.main)

        self.edit = MiniButton(Button(text="Change Command:"))
        self.edit.widget.bind(on_press=self.edit_callback)
        self.remove = MiniButton(Button(text="Remove Command"))
        self.remove.widget.bind(on_press=self.remove_callback)
        self.add_up = MiniButton(Button(text="Add Command Above"))
        self.add_up.widget.bind(on_press=self.add_up_callback)
        self.add_down = MiniButton(Button(text="Add Command Below"))
        self.add_down.widget.bind(on_press=self.add_down_callback)

        self.command = val
Exemplo n.º 5
0
    def __init__(self, *args, **kwargs):
        GridLayout.__init__(self, cols=9, rows=10)   # chuck all the controls into one grid

        model = App.get_running_app().profile.virtual_apc
        buttons = {}
        controls = {}

        for widget_data in model.grid.values():
            widget = create_widget(widget_data)
            if widget:
                self.add_widget(widget)

                if widget_data.type == SLIDER:
                    controls[widget_data.control] = widget
                    widget.bind(value=mk_event_dispatch(model, widget_data, EVENT_CHANGE))
                else:
                    buttons[widget_data.note] = widget
                    widget.bind(on_press=mk_event_dispatch(model, widget_data, EVENT_PRESS))
                    widget.bind(on_release=mk_event_dispatch(model, widget_data, EVENT_RELEASE))

                    if widget_data.type in [CLIP_LAUNCH, SCENE_LAUNCH, CONTROL]:
                        widget_data.on_change_color(widget.set_color)

        # WidgetObserver will update gui widgets on midi events
        widget_updater = WidgetUpdater(buttons, controls)
        model.add_observer(widget_updater)

        self.widget_updater = widget_updater
        self.model = model
Exemplo n.º 6
0
 def __init__(self):
     GridLayout.__init__(self)
     self.kontakty = {}
     self.wczytaj_kontakty()
     now = datetime.datetime.now()
     self.actual_data = \
         str(now.day) + '.' + str(now.month) + '.' + str(now.year)
Exemplo n.º 7
0
 def __init__(self):
     GridLayout.__init__(self, cols=2, spacing=20, padding=20)
     self.menuLabel = Label(text='菜名', font_name='./simhei.ttf')
     self.add_widget(self.menuLabel)
     self.detialLabel = Label(text='详细', font_name='./simhei.ttf')
     self.add_widget(self.detialLabel)
     self.menu1Name = Label(
         text='',
         font_name='./simhei.ttf')  # 初始化布局,text全设为'',待菜单抽取出来后由主页面来控制文本改变
     self.add_widget(self.menu1Name)
     self.menu1Detial = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu1Detial)
     self.menu2Name = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu2Name)
     self.menu2Detial = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu2Detial)
     self.menu3Name = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu3Name)
     self.menu3Detial = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu3Detial)
     self.menu4Name = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu4Name)
     self.menu4Detial = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu4Detial)
     self.menu5Name = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu5Name)
     self.menu5Detial = Label(text='', font_name='./simhei.ttf')
     self.add_widget(self.menu5Detial)
Exemplo n.º 8
0
    def __init__(self, **kwargs):

        GridLayout.__init__(self, **kwargs)
        Thread.__init__(self)

        self.cols = 1
        self.tool = ntoolbar(title='KivDL')
        self.add_widget(self.tool)
        self.body = GridLayout(cols=1, padding=(0, 20))
        self.add_widget(self.body)
        self.tex = MDTextField(pos_hint={'center_y': 0.9}, size_hint_x=0.8)
        self.tex.hint_text = " Enter URL to download"

        self.fetch_button = MDRaisedButton(text='Fetch',
                                           pos_hint={
                                               'center_y': 0,
                                               'right': 0.95
                                           },
                                           size_hint_x=0.1)
        self.fetch_button.bind(on_press=self.addcard)
        self.urlget = GridLayout(cols=2, size_hint_y=0.2)
        self.urlget.add_widget(self.tex)
        self.urlget.add_widget(self.fetch_button)
        self.body.add_widget(self.urlget)

        self.cardholder = ScrollView(do_scroll_x=False, size_hint_x=0.8)
        self.cardlist = MDList(padding=(10, 20))
        self.cardlist.spacing = (10, 20)
        self.cardholder.add_widget(self.cardlist)

        self.body.add_widget(self.cardholder)
        self.spacer = MDLabel(size_hint_y=0.2)
        self.cardlist.add_widget(self.spacer)
Exemplo n.º 9
0
    def __init__(self, *args, **kwargs):
        ## BOTTOM_LABELS = [[u"▲"], [u"▼"], [u"◀"], [u"▶"], ["volume", "pan", "send", "device"], ["shift"]]
        GridLayout.__init__(self, cols=9, rows=10)  # chuck all the controls into one grid
        self.note_buttons = {}
        self.control_sliders = {}

        scene_ids = xrange(82, 90).__iter__()
        for row in xrange(7, -1, -1):
            for col in xrange(0, 8):
                # first 8 cols are clip launchers
                note = (row * 8) + col
                self.add_widget(self.create_button("clip_launch_%d" % note, note))

            # last column is scene launch
            note = next(scene_ids)
            self.add_widget(self.create_button("scene_launch_%d" % row, note))

        # row 8 - control buttons and shift
        for i, note in enumerate(xrange(64, 72)):
            self.add_widget(self.create_button("control_%d" % i, note))

        self.add_widget(self.create_button("shift", 98))

        # row 9 - sliders
        for i, note in enumerate(xrange(48, 57)):
            self.add_widget(self.create_slider("slider_%d" % i, note))
Exemplo n.º 10
0
 def __init__(self, **kwargs):
     GridLayout.__init__(self)
     self.cols = 1  #important features-- represent no. of cols in screen
     #self.rows=2 #use with care
     self.wid = Label(font_size=25)
     self.add_widget(self.wid)
     Clock.schedule_interval(self.my_callback, 1)
Exemplo n.º 11
0
 def __init__(self, **kwargs):
     self.rows = 1
     self.cols = 1
     GridLayout.__init__(self, **kwargs)
     self.topLayout = BoxLayout(orientation="vertical")
     self.add_widget(self.topLayout)
     self.topLayout.add_widget(Label(text='tjosan'))
Exemplo n.º 12
0
    def __init__(self, client, buttons, cols=4, rows=4, **kwargs):
        GridLayout.__init__(self, cols=cols, rows=rows, spacing=10, padding=10, **kwargs)
        self._client = client

        for topic, text in buttons.items():
            button = MQTTToggleButton(text=text, font_size='40dp', client=client, topic=topic)
            self.add_widget(button)
Exemplo n.º 13
0
    def __init__(self):
        GridLayout.__init__(self, cols=1, rows=6)

        if(vars.red == None): 
            vars.red = 255
        if(vars.green == None): 
            vars.green = 255
        if(vars.blue == None): 
            vars.blue = 255

        self.redSlider = Slider(min=0, max=255, value=vars.red)
        self.redSlider.fbind('value', self.change_red)
        self.greenSlider = Slider(min=0, max=255, value=vars.green)
        self.greenSlider.fbind('value', self.change_green)
        self.blueSlider = Slider(min=0, max=255, value=vars.blue)
        self.blueSlider.fbind('value', self.change_blue)

        self.redText = Label(text="Rouge", markup = True)
        self.add_widget(self.redText)
        self.add_widget(self.redSlider)

        self.greenText = Label(text="Vert", markup = True)
        self.add_widget(self.greenText)
        self.add_widget(self.greenSlider)

        self.blueText = Label(text="Bleu", markup = True)
        self.add_widget(self.blueText)
        self.add_widget(self.blueSlider)
Exemplo n.º 14
0
    def __init__(self):
        GridLayout.__init__(self, cols=1, rows=2)

        self.brightLabel = Label(text="Luminosité")
        self.add_widget(self.brightLabel)
        self.brightSlider = Slider(min=0, max=100, value=50)
        self.brightSlider.fbind('value', self.change_brightness)
        self.add_widget(self.brightSlider)
Exemplo n.º 15
0
    def __init__(self, app, level_name, best_time, mode, color):
        self.app = app
        GridLayout.__init__(self, color=color)

        self.mode = mode

        self.ids['level_name'].text = level_name
        self.ids['best_time'].text = util.format_time(best_time)
Exemplo n.º 16
0
 def __init__(self):
     GridLayout.__init__(self, cols=2, rows=3);
     self.add_widget(Label(text='1st'))
     self.add_widget(Label(text='2nd'))
     self.add_widget(Label(text='3rd'))
     self.add_widget(Label(text='4th'))
     self.add_widget(Label(text='5th'))
     self.add_widget(Label(text='6th'))
Exemplo n.º 17
0
 def make_config_panel(self, lists):
     # 呼び出される度にWidgetを初期化する
     self.clear_widgets()
     # リストの数だけパネルのGridLayoutを準備する
     GridLayout.__init__(self, cols=1, rows=len(lists))
     # リストの数だけConfigPanelをWidgetに追加
     for text in lists:
         print(text)
         self.add_widget(Label(text=text))
Exemplo n.º 18
0
 def __init__(self):
     GridLayout.__init__(self)
     self.cols = 2
     self.add_widget(Label(text='user name'))
     self.username = TextInput(multiline=False)
     self.add_widget(self.username)
     self.add_widget(Label(text='password'))
     self.password = TextInput(password=True, multiline=False)
     self.add_widget(self.password)
     self.add_widget(Button(text='submit', on_press=self.submit))
Exemplo n.º 19
0
 def __init__(self):
     GridLayout.__init__(self, cols=2, spacing=20, padding=20)
     self.menuInputLabel = Label(text='菜单', font_name='./simhei.ttf')
     self.add_widget(self.menuInputLabel)
     self.detialInputLabel = Label(text='详细信息', font_name='./simhei.ttf')
     self.add_widget(self.detialInputLabel)
     self.menuInput = TextInput(font_name='./simhei.ttf')
     self.add_widget(self.menuInput)
     self.detialInput = TextInput(font_name='./simhei.ttf')
     self.add_widget(self.detialInput)
Exemplo n.º 20
0
 def __init__(self, numLines=10, **kwargs):
     # constructor of the board
     GridLayout.__init__(self, **kwargs)
     self.cols = numLines  # number of colomn in the gridLayout
     self.myBoard = list()  # all the cells in the board
     self.countBomb = 0
     self.bombAmount = Label(text=str(self.countBomb), font_size='20sp')
     self.firstMove = True
     self.finished = False
     self.createSquares()
Exemplo n.º 21
0
 def __init__(self):
     GridLayout.__init__(self)
     self.board = list()
     self.cols = 3
     self.turn = 1
     self.isdraw = 0
     for i in range(self.cols**2):
         self.board.append(Button())
         self.board[i].bind(on_press=self.click)
         self.add_widget(self.board[i])
Exemplo n.º 22
0
    def __init__(self, dim="sm", **kwargs):
        self.dim = dim

        GridLayout.__init__(self, rows=3, size_hint=(None, None), **kwargs)

        #self.top  = self.ids.top
        self.main = self.ids.main
        #self.bottom= self.ids.bottom

        self.bind(on_size=self.updateSize)
Exemplo n.º 23
0
    def __init__(self, **kwargs):
        GridLayout.__init__(self, **kwargs)
        self.bind(minimum_height=self.setter('height'))

        # Get External permissions and start Gallery
        print("Getting permissions")
        threading.Thread(target=self.get_permissions_and_run_func,
                         args=(self.build_gallery, )).start()

        print("build gallery")
Exemplo n.º 24
0
 def __init__(self, *args, **kwargs):
     GridLayout.__init__(self,*args,**kwargs)
     for row in Loki.range(3):
             for col in Loki.range(3):
                 _coords = {"coords" : (row,col)}
                 gridEntry = GridEntry(**_coords)
                 _button_pressed = self.buttonPressed
                 _on_release = {"on_release" : _button_pressed}
                 (gridEntry.bind(**_on_release) if callable(gridEntry.bind) else gridEntry.bind)
                 (self.add_widget(gridEntry) if callable(self.add_widget) else self.add_widget)
Exemplo n.º 25
0
 def __init__(self, game):
     self.__game = game
     self.__cols, self.__rows = game.size()
     GridLayout.__init__(self, cols=self.__cols)
     
     for y in xrange(0, self.__rows):
         for x in xrange(0, self.__cols):
             btn = GridButton(grid_pos=(x, y))
             btn.bind(on_release=self.handle_click)
             self.add_widget(btn)
     self.update_all_buttons()
Exemplo n.º 26
0
 def __init__(self):        
     GridLayout.__init__(self,cols=3)
     self.add_widget(Label(text="Layout 2",font_size='30sp',
                           size_hint_x=None, width=150))
     gifimg=AsyncImage(source=".\\Gif1.gif",anim_delay=30/1000)
     self.add_widget(gifimg)
     
     btn=Button(text="switch to Layout 1",
                size_hint_x=None, width=150)
     btn.bind(on_press=self.changeLayout)
     self.add_widget(btn)
Exemplo n.º 27
0
    def __init__(self, **kwargs):
        self.rows = 2
        self.cols = 1
        GridLayout.__init__(self, **kwargs)

        self.mainPanel = TabbedPanel()
        self.mainPanel.default_tab_content = AfInputDevice()
        print "WIDTH", self.width
        self.mainPanel.default_tab_text = "Default Input"
        self.add_widget(self.mainPanel)
        self.add_widget(Button(text="Add new"))
Exemplo n.º 28
0
 def __init__(self):
     # 0 represent unknown
     GridLayout.__init__(self)
     self.problem = [-1] * 8
     self.cols = 8
     self.all = list()
     self.button = Button(text='Next solution')
     self.button.bind(on_press=self.click)
     self.bruteForce(0)
     self.add_board()
     self.add_widget(self.button)
Exemplo n.º 29
0
    def __init__(self, game):
        self.__game = game
        self.__cols, self.__rows = game.size()
        GridLayout.__init__(self, cols=self.__cols)

        for y in xrange(0, self.__rows):
            for x in xrange(0, self.__cols):
                btn = GridButton(grid_pos=(x, y))
                btn.bind(on_release=self.handle_click)
                self.add_widget(btn)
        self.update_all_buttons()
Exemplo n.º 30
0
    def __init__(self, desc, **kwargs):
        GridLayout.__init__(self, **kwargs)
        self.cols = 1
        self.rows = 2
        self.desc = desc
        self.led = Image(source=self.led_source, size_hint=(.75, .75))
        self.add_widget(self.led)

        self.label = label = EditableLabel(size_hint=(1, .25))
        label.text = desc
        self.add_widget(label)
Exemplo n.º 31
0
 def __init__(self):        
     GridLayout.__init__(self,cols=1)
     label=Label(text="Kivy Layout1",font_size='30sp',
                 size_hint_y=None, height=100)
     self.add_widget(label)
     gifimg=AsyncImage(source=".\\Gif0.gif",anim_delay=30/1000)
     self.add_widget(gifimg)
     
     btn=Button(text="switch to Layout 2",
                size_hint_y=None, height=100)
     btn.bind(on_press=self.changeLayout)
     self.add_widget(btn)
Exemplo n.º 32
0
    def __init__(self, character, controller):
        GridLayout.__init__(self)
        self.character = character
        self.character.subscribe(self._species_update,
                                 self.character.SPECIES_CHANGE_EVENT)
        self.character.subscribe(self._class_update,
                                 self.character.CLASS_CHANGE_EVENT)
        self.character.subscribe(self._ability_update,
                                 self.character.ABILITY_CHANGE_EVENT)
        self.controller = controller

        self._ability_update()
Exemplo n.º 33
0
 def __init__(self, board, randomPlayer, **kwargs):
     GridLayout.__init__(self, **kwargs)
     self.board = board  # The game board
     self.cols = 5  # The size of one dimension of the board
     self.rows = self.cols
     self.graphic_representation = []  # A matrix that holds all of the buttons
     self.moving = False  # An indication boolean which is true when buttons are highlighted and a piece is chosen
     # and is ready to move
     self.moveable_to = []  # A list that holds all of the buttons that a chosen game piece can move to
     self.clicked_button = None  # A variable that holds the currently clicked button
     self.game_over_text = None  # A text that shows up when the game is over
     self.random = randomPlayer  # G for the guards to be the random player and M for the musketeers to be the random player
Exemplo n.º 34
0
 def __init__(self, numLines=10, **kwargs):
     # constructor of the board
     GridLayout.__init__(self, **kwargs)
     self.cols = numLines  # number of colomn in the
     self.myBoard = list()  # all the cells in the boardgridLayout
     self.game_over = False
     self.to_reveal = 0
     self.randomBomb()  # choose the bombs in the game
     self.changeNumInCell()
     l = Label(text='num bombs', font_size='20sp')
     self.l1 = Label(text=str(self.countBomb), font_size='20sp')
     self.add_widget(l)
     self.add_widget(self.l1)
Exemplo n.º 35
0
    def __init__(self):

        all_data = pd.read_csv('iris.csv')

        self.data = all_data.drop('species', axis=1)
        self.data = self.data.drop('Unnamed: 0', axis=1)
        self.data = self.data.values
        self.target = all_data['species']
        self.target = self.target.values

        basic_plot = BasicPlot()
        basic_plot.save_basic_plot(self.data, self.target)
        GridLayout.__init__(self)
Exemplo n.º 36
0
    def __init__(self, **kwargs):
        # XXX: strange super() behaviour here!
        # super().__init__()
        GridLayout.__init__(self)
        self.setting_value = kwargs.get('setting_value')
        self.setting_min = kwargs.get('setting_min')
        self.setting_max = kwargs.get('setting_max')
        self.setting_type = kwargs.get('setting_type')
        self.label_text = kwargs.get('label_text')
        self.items = kwargs.get('items', [])
        self.size_hint = kwargs.get('size_hint', (1, None))
        self.rows = 1

        self.build_interface()
Exemplo n.º 37
0
    def __init__(self):
        GridLayout.__init__(self, cols=2, rows=3, spacing=[5, 5])

        self.result = (None, None, None)

        self.size_text_input = NumericTextInput((10, 50), text="3")
        self.cell_text_input = NumericTextInput((0.1, 1.0), True, text="0.3")

        self.ok_button = Button(text="OK")
        self.cancel_button = Button(text="Cancel")

        self.add_widget(Label(text="Size: "))
        self.add_widget(self.size_text_input)

        self.add_widget(Label(text="Cell Size: "))
        self.add_widget(self.cell_text_input)

        self.add_widget(self.ok_button)
        self.add_widget(self.cancel_button)
Exemplo n.º 38
0
    def __init__(self, **kwargs):
        GridLayout.__init__(self, cols=kwargs['grid_size'][0], **kwargs)
        self.layout = kwargs['layout']
        self.grid_size = kwargs['grid_size']
        self.effects_propability = kwargs['effects_propability']
        self.tiles = []
        self.changes = []
        self.frozen = False
        self.tile_resized = 0
        self.tiles_amount = self.grid_size[0] * self.grid_size[1]

        for i, tile_type in enumerate(self.layout):
            ix = i % self.grid_size[0]
            iy = i // self.grid_size[0]
            tile = GameTile(type=tile_type, ix=ix, iy=iy)
            self.add_widget(tile)
            self.tiles.append(tile)

        self.aimap = AIMap(self)
Exemplo n.º 39
0
 def __init__(self, **kwargs):
     GridLayout.__init__(self, cols=2, **kwargs)
Exemplo n.º 40
0
    def __init__(self, app, **kwargs):
        GridLayout.__init__(self, **kwargs)

        self.app = app
 def __init__(self, **kwargs):
     GridLayout.__init__(self, **kwargs)
     # Set up out model
     self.data_model = DataModel()
     self.ui_data_model._model = self.data_model