コード例 #1
0
    def unlock_folder_dialog(self, folderpath, outputpath, url):
        def close_dialog(instance, *args):
            instance.parent.parent.parent.parent.dismiss()

        layout = MDBoxLayout(orientation="vertical", adaptive_height=True)
        layout.add_widget(
            MDTextField(
                text=
                "Sudo password to change the rights of the destination folder",
                font_style="H6"))
        layout.add_widget(
            MDTextField(hint_text="Password", password=True, mode="rectangle"))
        dialog = MDDialog(
            title="",
            type='custom',
            auto_dismiss=False,
            content_cls=layout,
            buttons=[
                MDFlatButton(text="ENTER",
                             on_release=partial(self.unlock_folder, folderpath,
                                                outputpath, url)),
                MDFlatButton(text="DISCARD", on_release=close_dialog),
            ],
        )
        if get_app()._platform not in ['win32', 'win64']:
            # TODO: Focus function seems buggy in win
            dialog.content_cls.focused = True
        dialog.open()
コード例 #2
0
    def build(self):
        # box around evertying
        box_global = MDBoxLayout()
        box_global.orientation = 'vertical'
        # add the toolbar
        box_global.add_widget(MDToolbar(title='buba'))

        # add the tabs
        tabs = MDTabs()
        box_global.add_widget(tabs)

        # The search tab
        # tab = MDTabsBase()
        tab = Tab()
        # tab.size_hint = (None,None)
        tab.size = box_global.size
        tab.spacing = 10
        tab.text = 'search'
        tabs.add_widget(tab)

        tab.add_widget(StandardLabel(text='Check-in'))
        tab.add_widget(SelectDateButton())
        tab.add_widget(StandardDateField())

        tab.add_widget(StandardLabel(text='Check-out'))
        tab.add_widget(SelectDateButton())
        tab.add_widget(StandardDateField())

        tab.add_widget(SaveButton())
        tab.add_widget(SearchButton())

        # tab.padding_top = 3
        # tab.add_widget(Widget())

        return box_global
コード例 #3
0
    def overwrite_existing_file_dialog(self, overwrite_func, outputpath):
        def close_dialog(instance, *args):
            instance.parent.parent.parent.parent.dismiss()

        layout = MDBoxLayout(orientation="vertical", adaptive_height=True)
        layout.add_widget(
            OneLineListItem(text="Overwrite existing destination file?",
                            font_style="H6"))
        layout.add_widget(
            MDTextField(text=str(outputpath.absolute()),
                        multiline=True,
                        readonly=True,
                        mode="rectangle"))
        dialog = MDDialog(
            title="",
            type='custom',
            auto_dismiss=False,
            content_cls=layout,
            buttons=[
                MDFlatButton(text="OVERWRITE",
                             on_release=partial(overwrite_func, outputpath)),
                MDFlatButton(text="DISCARD", on_release=close_dialog),
            ],
        )
        if get_app()._platform not in ['win32', 'win64']:
            # TODO: Focus function seems buggy in win
            dialog.content_cls.focused = True
        dialog.open()
コード例 #4
0
    def makeLocalServiceEditPage(self):

        screen = Screen(name='EditLocalService')
        self.servicesScreen = screen

        layout = BoxLayout(orientation='vertical', spacing=10)
        screen.add_widget(layout)
        self.localServiceEditorName = Label(size_hint=(1, None),
                                            halign="center",
                                            text="??????????")

        layout.add_widget(self.makeBackButton())

        self.localServiceEditPanelScroll = ScrollView(size_hint=(1, 1))

        self.localServiceEditPanel = BoxLayout(orientation='vertical',
                                               size_hint=(1, None))
        self.localServiceEditPanel.bind(
            minimum_height=self.localServiceEditPanel.setter('height'))

        self.localServiceEditPanelScroll.add_widget(self.localServiceEditPanel)

        layout.add_widget(self.localServiceEditPanelScroll)

        return screen
コード例 #5
0
def install_tesseract_dialog():
    def close_dialog(instance, *args):
        instance.parent.parent.parent.parent.dismiss()

    layout = MDBoxLayout(orientation="horizontal", adaptive_height=True)
    layout.add_widget(
        OneLineListItem(
            text=
            "Tesseract wasn't found on the system. You can install it now or set"
            "the right path in the settings-menu. (Restart required)"))
    dialog = MDDialog(
        title="Installing tesseract?",
        type='custom',
        auto_dismiss=False,
        content_cls=layout,
        buttons=[
            MDFlatButton(text="INSTALL",
                         on_release=partial(install_tesseract)),
            MDFlatButton(text="DISCARD", on_release=close_dialog),
        ],
    )
    if get_app()._platform not in ['win32', 'win64']:
        # TODO: Focus function seems buggy in win
        dialog.content_cls.focused = True
    dialog.open()
コード例 #6
0
 def build(self):
     # box around evertying
     box_global = MDBoxLayout()
     box_global.orientation = 'vertical'
     # add the toolbar
     box_global.add_widget(MDToolbar(title = 'buba'))
     
     # add the tabs
     tabs = MDTabs()
     box_global.add_widget(tabs)
     
     # The search tab
     # tab = MDTabsBase()
     tab = Tab(size = box_global.size)
     tab.text = 'search'
     tabs.add_widget(tab)
     
     # box = MDBoxLayout()
     # tab.add_widget(box)
     # box.orientation = 'vertical'
     
     # # button = MDFlatButton()
     tab.add_widget(StartDateContainer())
     tab.add_widget(SaveButton())
     tab.add_widget(Widget())
     
     return box_global
コード例 #7
0
    def issues(self):
        if self.others is False:
            frame = MDBoxLayout(orientation='vertical',
                                size_hint_y=None,
                                height=150)
            scroll = ScrollView()
            list_view = MDList()

            scroll.add_widget(list_view)

            remarks = [
                'Awaiting Result', 'Token not found', 'Passport Uploaded',
                'Wrong result uploaded', 'No results uploaded',
                'Card limit exceeded', 'Invalid card', 'Result not uploaded',
                'Incomplete Result', 'Result not visible', 'Invalid pin',
                'Invalid serial', 'Result checker has been used',
                'Pin for Neco not given', 'Wrong result uploaded',
                'Incomplete result', 'Token linked to another candidate',
                'Others'
            ]

            for x in remarks:
                list_view.add_widget(
                    OneLineListItem(text=x, on_press=self.get_selection))

            self.chooser = MDDialog(title='Select Remark',
                                    size_hint=(.5, .4),
                                    type='custom',
                                    content_cls=frame)
            frame.add_widget(scroll)
            # self.chooser.set_normal_height()
            self.chooser.open()
コード例 #8
0
 def build(self):
     # box around evertying
     box_global = MDBoxLayout()
     box_global.orientation = 'vertical'
     # add the toolbar
     box_global.add_widget(MDToolbar(title = 'buba'))
     
     # add the tabs
     tabs = MDTabs()
     box_global.add_widget(tabs)
     
     # The search tab
     # tab = MDTabsBase()
     tab = Tab(size = box_global.size)
     tab.text = 'search'
     tabs.add_widget(tab)
     
     # box = MDBoxLayout()
     # tab.add_widget(box)
     # box.orientation = 'vertical'
     
     # # button = MDFlatButton()
     # tab.add_widget(StartDateContainer())
     tab.add_widget(SelectDateButton())
     self.start_date_text = StandardTextField()
     self.start_date_text.hint_text = 'mm/dd/yyyy'
     # tab.add_widget(self.start_date_text)
     tab.add_widget(SaveButton(padding = 3))
     tab.add_widget(SaveButton())
     tab.add_widget(SaveButton())
     
     tab.padding_top = 3
     # tab.add_widget(Widget())
     
     return box_global
コード例 #9
0
    def remove_jobdata_dialog(self, *args):
        def close_dialog(instance, *args):
            instance.parent.parent.parent.parent.dismiss()

        layout = MDBoxLayout(orientation="vertical", adaptive_height=True)
        layout.add_widget(
            OneLineListItem(text="You really want to delete these jobs?",
                            font_style="H6"))
        layout.add_widget(
            MDTextField(text=" / ".join(
                set([job[0] for job in self.job_table.get_row_checks()])),
                        multiline=True,
                        readonly=True,
                        mode="rectangle"))
        dialog = MDDialog(
            title="Remove jobdata from server",
            type='custom',
            auto_dismiss=False,
            content_cls=layout,
            buttons=[
                MDFlatButton(text="DELETE",
                             on_release=partial(self.remove_jobdata)),
                MDFlatButton(text="DISCARD", on_release=close_dialog),
            ],
        )
        if get_app()._platform not in ['win32', 'win64']:
            dialog.content_cls.focused = True
        dialog.open()
コード例 #10
0
 def imprimiralchatbox(self, texto):
     new_box = MDBoxLayout(size_hint=(0.8, None), orientation='horizontal', height=50, pos_hint={'x': 0.2})
     new_box.add_widget(WidgetCreator.newlabel(texto, valign='middle', halign='right', size_hint=(1.0, None)))
     with new_box.canvas.before:
         Color(usermessagebubblecolor[0], usermessagebubblecolor[1], usermessagebubblecolor[2])
         new_box.rect = RoundedRectangle(size=new_box.size, pos=new_box.pos, radius=[25, 0, 25, 25])
     new_box.bind(pos=WidgetCreator.update_rect, size=WidgetCreator.update_rect)
     self.layout.chatbox.content.add_widget(new_box)
コード例 #11
0
    def build(self):
        bl = MDBoxLayout(orientation="vertical")

        i = ScreenERWSWid(size_hint=[None, None], size=[512, 512])
        self.can = i.canvas
        bl.add_widget(i)

        return bl
コード例 #12
0
 def establecerfase(self, fase: Fase):
     self.layout.faselabel.text = fase.nombre
     new_box = MDBoxLayout(size_hint=(0.8, None), orientation='horizontal', height=50)
     new_box.add_widget(WidgetCreator.newlabel(fase.texto, size_hint=(1.0, None), valign='middle'))
     with new_box.canvas.before:
         Color(botmessagebubblecolor[0], botmessagebubblecolor[1], botmessagebubblecolor[2])
         new_box.rect = RoundedRectangle(size=new_box.size, pos=new_box.pos, radius=[0, 25, 25, 25])
     new_box.bind(pos=WidgetCreator.update_rect, size=WidgetCreator.update_rect)
     self.layout.chatbox.content.add_widget(new_box)
コード例 #13
0
class LoginScreenBase(GenericFormScreen):
    def __init__(self, **kwargs):
        super(LoginScreenBase, self).__init__(**kwargs)

        self.previous = "registered"

        self.emailTextField = self.create_email_field()
        self.contentBox.add_widget(self.emailTextField)

        self.passwordTextField = self.create_password_field()
        self.contentBox.add_widget(self.passwordTextField)

        self.submitButton = Builder.load_string(standard_button)
        self.submitButton.text = "Login"
        self.submitButton.bind(on_press=partial(self.verify_and_submit_values))

        self.backButton = Builder.load_string(standard_button)
        self.backButton.text = "Back"
        self.backButton.bind(on_press=partial(self.goto_previous_screen))

        self.buttonBox = MDBoxLayout(pos_hint={
            'center_x': 0.5,
            'center_y': 0.5
        })
        self.buttonBox.orientation = 'horizontal'
        self.buttonBox.adaptive_height = False
        self.buttonBox.add_widget(self.backButton)
        self.buttonBox.add_widget(self.submitButton)

        self.contentBox.add_widget(self.buttonBox)

    def verify_inputs(self):
        found_error = [False]

        self.verify_email(self.emailTextField, found_error)

        self.verify_password(self.passwordTextField, found_error)

        return not found_error[0]

    def get_form_values(self):
        loginDict = {
            "Email": self.emailTextField.text,
            "Password": self.passwordTextField.text
        }

        return loginDict

    def submit_form(self, values):
        thread = Thread(target=database_login, args=(
            self,
            values,
        ))
        thread.start()
コード例 #14
0
    def __init__(self, **kwargs):
        # Giving main text and icon to this tab
        super().__init__(name="graph", text="Graph", icon="graphql", **kwargs)

        layout = MDBoxLayout(orientation="vertical")
        tabs = MDTabs(text_color_active=(1, 1, 1, 1),
                      text_color_normal=(1, 1, 1, 1))
        screens = (GraphScreen(text='Graph'), PieScreen(text='Pie Chart'))
        for screen in screens:
            tabs.add_widget(screen)
        layout.add_widget(tabs)
        self.add_widget(layout)
コード例 #15
0
    def getRowForGui(self, name):
        rb = MDBoxLayout(orientation='horizontal')
        vl = MDTextField()
        rb.add_widget(vl)
        #rb.add_widget( Label(text="   {}:".format(name) ) )
        #vl = Label(text="- - -")
        #rb.add_widget(vl)

        vl.hint_text = "{}:".format(name)
        vl.text = "- - -"
        vl.disabled = True

        return vl, rb
コード例 #16
0
class Main(MDApp):
    def __init__(self):
        super(Main, self).__init__()
        self.theme_cls.primary_palette = "Amber"

        self.title = "Four in a row"
        self.root = Builder.load_file("style.kv")
        self.current_widget = MDBoxLayout()

        self.start_widget = StartWidget(self.start_game, self.change_theme)
        self.theme_widget = ThemeWidget(self, self.return_back)
        self.current_widget.add_widget(self.start_widget)

    def change_theme(self):
        self.current_widget.clear_widgets()
        self.current_widget.add_widget(self.theme_widget)

    def start_game(self):
        self.current_widget.clear_widgets()
        self.current_widget.add_widget(GameWidget(self.return_back))

    def return_back(self):
        self.current_widget.clear_widgets()
        self.current_widget.add_widget(self.start_widget)

    def build(self):
        return self.current_widget
コード例 #17
0
class Example(MDApp):
    def build(self):
        self.tmp_outer_box = MDBoxLayout(orientation='vertical')
        self.tmp_toolbar = MDToolbar(title="Example Tabs")
        self.tmp_tabs = MDTabs()

        self.tmp_outer_box.add_widget(self.tmp_toolbar)
        self.tmp_outer_box.add_widget(self.tmp_tabs)

        return self.tmp_outer_box

    def on_start(self):
        for i in range(40):
            self.tmp_tabs.add_widget(Tab(title=f"Tab {i}"))
コード例 #18
0
class MyApp(MDApp):
    def __init__(self):
        super(MyApp, self).__init__()
        self.boxlayout1 = MDBoxLayout(orientation="vertical")

        toolbar = MDToolbar(title="DEMO APP")

        toolbar.left_action_items = [["menu", "This is the navigation"]]
        toolbar.right_action_items = [[
            "dots-vertical", lambda x: self.callback_1(x)
        ], ["clock"]]

        self.boxlayout1.add_widget(toolbar)

        self.boxlayout2 = MDBoxLayout()
        self.boxlayout1.add_widget(self.boxlayout2)

        from kivymd.uix.navigationrail import MDNavigationRail, MDNavigationRailItem
        self.navigationrail = MDNavigationRail(
            md_bg_color=get_color_from_hex("#ffffff"),
            # color_normal = get_color_from_hex("#718089"), #crash the app when clicking on an item, don't understand why...
            color_active=get_color_from_hex("#f3ab44"),
            visible="Persistent")

        self.item1 = MDNavigationRailItem(navigation_rail=self.navigationrail,
                                          text="Detection",
                                          icon='video-stabilization')
        self.item2 = MDNavigationRailItem(navigation_rail=self.navigationrail,
                                          text="Dashboard",
                                          icon='desktop-mac-dashboard')
        self.item3 = MDNavigationRailItem(navigation_rail=self.navigationrail,
                                          text="Settings",
                                          icon='cog-outline')
        self.navigationrail.add_widget(self.item1)
        self.navigationrail.add_widget(self.item2)
        self.navigationrail.add_widget(self.item3)

        self.boxlayout2.add_widget(self.navigationrail)

    def callback_1(self, *args, **kwargs):
        sl = MDStackLayout()
        sl.add_widget(MDTextField(hint_text='Enter something'))
        sl.add_widget(MDRaisedButton(text="I AM A BUTTON"))
        self.boxlayout2.add_widget(sl)

    def build(self):
        Clock.schedule_once(self.set_width)
        return self.boxlayout1

    def set_width(self, interval):
        self.navigationrail.size_hint_x = None
        self.navigationrail.width = dp(120)
        #self.navigationrail.md_bg_color = (1, 1, 1, 1)

        self.item1.size_hint_x = None
        self.item1.width = dp(120)
        self.item2.size_hint_x = None
        self.item2.width = dp(120)
        self.item3.size_hint_x = None
        self.item3.width = dp(120)
コード例 #19
0
 def __init__(self, **kwargs):
     super(SimulacionScreenLayout, self).__init__(**kwargs)
     self.padding = [10, 10, 10, 10]
     self.orientation = 'vertical'
     self.faselabel = WidgetCreator.newlabel("Nombre de Fase", size_hint=(1.0, None))
     self.add_widget(self.faselabel)
     chat = BoxLayout(orientation="horizontal", size_hint=(1, 1), spacing=10)
     chat.add_widget(WidgetCreator.newimage('assets/BotFace.jpg'))
     self.chatbox = ChatBox(size_hint=(1, 1))
     chat.add_widget(self.chatbox)
     self.add_widget(chat)
     self.camara = Image(size_hint=(1, 1), pos_hint={'top': 1})
     self.soundwave = FigureCanvasKivyAgg(AudioController().fig)
     self.userinputbox = UserInputBox(self.camara, self.soundwave, padding=[10, 10, 10, 10], spacing=10)
     self.add_widget(self.userinputbox)
     Clock.schedule_interval(self.update, 1.0 / 30.0)
コード例 #20
0
ファイル: helper.py プロジェクト: Adarshb2000/Home-Automation
    def build(self):
        # Image
        ac_image = Image(source='static/ac1.png')
        ac_image.size_hint = (1.25, 1.5)
        ac_image.pos_hint = {'center_x': 0.5}
        self.add_widget(ac_image)

        # Details
        details_box = MDBoxLayout(orientation='horizontal', size_hint_y=0.5)
        self.temprature = MDLabel(text='18°C')
        self.temprature.color = [1] * 4
        self.fan_speed = MDLabel(text='Fan: 2')
        self.fan_speed.color = [1] * 4
        details_box.add_widget(self.temprature)
        details_box.add_widget(self.fan_speed)
        self.add_widget(details_box)
コード例 #21
0
    def makeLocalServicesPage(self):

        screen = Screen(name='LocalServices')
        self.servicesScreen = screen

        layout = BoxLayout(orientation='vertical', spacing=10)
        screen.add_widget(layout)

        label = Label(
            size_hint=(1, None),
            halign="center",
            text=
            'WARNING: Running a local service may use a lot of data and battery.\nChanges may require service restart.'
        )

        labelw = Label(
            size_hint=(1, None),
            halign="center",
            text=
            'WARNING 2: This app currently prefers the external SD card for almost everything including the keys.'
        )

        layout.add_widget(self.makeBackButton())

        layout.add_widget(label)
        layout.add_widget(labelw)

        btn2 = Button(text='Create a service')

        btn2.bind(on_press=self.promptAddService)
        layout.add_widget(btn2)

        self.localServicesListBoxScroll = ScrollView(size_hint=(1, 1))

        self.localServicesListBox = BoxLayout(orientation='vertical',
                                              size_hint=(1, None),
                                              spacing=10)
        self.localServicesListBox.bind(
            minimum_height=self.localServicesListBox.setter('height'))

        self.localServicesListBoxScroll.add_widget(self.localServicesListBox)

        layout.add_widget(self.localServicesListBoxScroll)

        return screen
コード例 #22
0
    def add_actions_buttons(self, instance_box: MDBoxLayout,
                            data: list) -> None:
        """
        Adds buttons to the banner.

        :param data: ['NAME BUTTON', <function>];
        """

        if data:
            name_action_button, function_action_button = data
            action_button = MDFlatButton(
                text=f"[b]{name_action_button}[/b]",
                theme_text_color="Custom",
                text_color=self.theme_cls.primary_color,
                on_release=function_action_button,
            )
            action_button.markup = True
            instance_box.add_widget(action_button)
コード例 #23
0
    def new(self, *args):
        self.close()
        layout = MDBoxLayout(orientation='vertical',
                             spacing='12dp',
                             size_hint_y=None,
                             height="20dp")
        self.nam = MDTextField()
        layout.add_widget(self.nam)

        self.dialog = MDDialog(
            title="Edit",
            type='custom',
            content_cls=layout,
            buttons=[
                MDFlatButton(text='Okay', on_press=self.ok),
            ],
        )
        # self.dialog.set_normal_height()
        self.dialog.open()
コード例 #24
0
    def add_content(self, lang):
        '''Adds main content in the specified language to the HomeScreen'''
        self.home_content.clear_widgets()
        self.titles = languages[lang]['home_titles']
        self.texts = languages[lang]['home_texts']

        for tls, txs, ics in zip(self.titles, self.texts, self.icons):
            content = MDBoxLayout(adaptive_height=True,
                                  orientation='vertical',
                                  padding=[dp(25), dp(100)])
            content.add_widget(
                MDLabel(text=txs,
                        size_hint=(1, None),
                        height=dp(Window.height * .1),
                        theme_text_color='Secondary'))
            self.home_content.add_widget(
                MDExpansionPanel(icon='images/' + ics,
                                 content=content,
                                 panel_cls=MDExpansionPanelOneLine(text=tls)))
コード例 #25
0
    def win(self):
        theme_cls = MDApp.get_running_app().theme_cls
        win_popup = Popup(title=f"User {self.game.current_player} won!")

        content = MDBoxLayout(orientation="vertical",
                              md_bg_color=theme_cls.primary_dark)
        content.add_widget(
            MDLabel(text=f"User {self.game.current_player} won!",
                    theme_text_color='Primary',
                    halign="center"))
        content.add_widget(
            MDRaisedButton(text="Exit",
                           on_press=lambda x: self.game_win_return(win_popup),
                           size_hint=(1, None),
                           md_bg_color=theme_cls.primary_color,
                           font_size="20"))

        win_popup.content = content
        win_popup.open()
コード例 #26
0
def install_unix_dialog():
    def close_dialog(instance, *args):
        instance.parent.parent.parent.parent.dismiss()

    layout = MDBoxLayout(orientation="horizontal", adaptive_height=True)
    layout.add_widget(MDTextField(hint_text="Password", password=True))
    dialog = MDDialog(
        title=
        "Enter sudo password to change the rights of the destination folder",
        type='custom',
        auto_dismiss=False,
        content_cls=layout,
        buttons=[
            MDFlatButton(text="ENTER", on_release=partial(install_unix)),
            MDFlatButton(text="DISCARD", on_release=close_dialog),
        ],
    )
    dialog.content_cls.focused = True
    dialog.open()
コード例 #27
0
ファイル: bookstab.py プロジェクト: Dark-on/pms-labs
class BookInfoScreen(MDScreen):
    """Contains layout with detailed information about the choosen
    book.

    Also containstoolbar with buttons for getting back to the books list
    and deleting the choosen book from the list.
    """

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        scroll_view = ScrollView()
        self.layout = MDBoxLayout(orientation="vertical", size_hint=(1, 1.2))
        scroll_view.add_widget(self.layout)
        self.add_widget(scroll_view)

    def load_screen(self, book):
        """Loads all elements for the detailed info.

        Created as separate method because on every book we need to reload the
        information.
        """
        self.book = book

        toolbar = MDToolbar(type="top")
        toolbar.left_action_items = [["arrow-left", self.go_back]]
        toolbar.right_action_items = [["delete", self.delete_item]]

        content = BookInfoContent(book)

        self.layout.add_widget(toolbar)
        self.layout.add_widget(content)

    def go_back(self, touch):
        self.layout.clear_widgets()
        self.manager.transition.direction = "right"
        self.manager.switch_to(BooksTab.screens["books_list"])

    def delete_item(self, touch):
        BooksTab.screens["books_list"].books.remove(self.book)
        books_list = BooksTab.screens["books_list"].books
        BooksTab.screens["books_list"].load_books_list(books_list)
        self.go_back(touch)
コード例 #28
0
    def overwrite_existing_file_dialog(self, outputpath):
        def close_dialog(instance, *args):
            instance.parent.parent.parent.parent.dismiss()

        layout = MDBoxLayout(orientation="horizontal", adaptive_height=True)
        layout.add_widget(OneLineListItem(text=str(outputpath.absolute())))
        dialog = MDDialog(
            title="Overwrite existing destination file?",
            type='custom',
            auto_dismiss=False,
            content_cls=layout,
            buttons=[
                MDFlatButton(text="OVERWRITE",
                             on_release=partial(self.start_download_model,
                                                outputpath)),
                MDFlatButton(text="DISCARD", on_release=close_dialog),
            ],
        )
        dialog.content_cls.focused = True
        dialog.open()
コード例 #29
0
    def makeGlobalSettingsPage(self):

        screen = Screen(name='GlobalSettings')
        layout = BoxLayout(orientation='vertical', spacing=10)
        screen.add_widget(layout)

        layout.add_widget(self.makeBackButton())

        self.localSettingsScroll = ScrollView(size_hint=(1, 1))
        self.localSettingsBox = BoxLayout(orientation='vertical',
                                          size_hint=(1, None),
                                          spacing=10)
        self.localSettingsBox.bind(
            minimum_height=self.localSettingsBox.setter('height'))

        self.localSettingsScroll.add_widget(self.localSettingsBox)

        layout.add_widget(self.localSettingsScroll)

        return screen
コード例 #30
0
ファイル: unix.py プロジェクト: JKamlah/tesseractXplore
def run_cmd_with_sudo_dialog(title="",func=None):
    def close_dialog(instance, *args):
        instance.parent.parent.parent.parent.dismiss()
    layout = MDBoxLayout(orientation="horizontal", adaptive_height=True)
    layout.add_widget(MDTextField(hint_text="Password",password=True))
    dialog = MDDialog(title=title,
                      type='custom',
                      auto_dismiss=False,
                      content_cls=layout,
                      buttons=[
                          MDFlatButton(
                              text="ENTER", on_release=partial(func)
                          ),
                          MDFlatButton(
                              text="DISCARD", on_release=close_dialog
                          ),
                      ],
                      )
    dialog.content_cls.focused = True
    dialog.open()