Exemplo n.º 1
0
    def __init__(self, *args, **kwargs):
        self.callback = kwargs.pop("callback", None)
        self.pages = kwargs.pop("pages",
                                ["general", "synchronisation", "kivy"])
        self.title = "Paramètres"
        self.size_hint = (0.9, 0.9)

        config = ConfigParser()
        config.read(os.path.join(UTILS_Divers.GetRepData(), "config.cfg"))

        self.settings = Settings()
        self.settings.register_type('password', SettingPassword)
        self.settings.register_type('chaine', SettingChaine)

        if "general" in self.pages:
            self.settings.add_json_panel("Généralités",
                                         config,
                                         data=json.dumps(JSON_GENERAL))
        if "synchronisation" in self.pages:
            self.settings.add_json_panel("Synchronisation",
                                         config,
                                         data=json.dumps(JSON_SYNCHRONISATION))
        if "kivy" in self.pages: self.settings.add_kivy_panel()

        self.settings.interface.menu.close_button.text = "Fermer"

        self.content = self.settings
        self.settings.bind(on_close=self.OnBoutonFermer)
        self.bind(on_dismiss=self.on_dismiss)
        super(Popup, self).__init__(*args, **kwargs)
Exemplo n.º 2
0
 def test_build_settings(self):
     config = ConfigParser()
     self.app.build_config(config)
     reglages = Settings()
     self.app.build_settings(reglages)
     panels = reglages.children[0].content.panels
     for panel in SETTING_PANELS:
         assert any(p.title == panel[0] for p in panels.values())
Exemplo n.º 3
0
    def on_enter(self):
        root = App.get_running_app().root

        s = Settings(on_close=self.close)

        s.add_json_panel('Network', root.config, 'panels/network.json')
        s.add_json_panel('Stream', root.config, 'panels/stream.json')

        self.add_widget(s)
Exemplo n.º 4
0
    def __init__(self, **kwargs):
        super(ListParam, self).__init__(**kwargs)

        from kivy.uix.settings import Settings, SettingsWithSpinner, SettingsPanel
        from kivy.config import ConfigParser

        print("parammmmmmmm")

        #json param
        #graphics
        conf_graphics = [
            #{"type": "title", "title": "Windows"},
            {
                "type": "bool",
                "title": "Fullscreen",
                "desc": "Set the window in windowed or fullscreen",
                "section": "graphics",
                "key": "fullscreen"
            }
        ]

        #theme
        conf_theme = [{
            "type": "options",
            "title": "Style",
            "desc": "Style des fenêtres",
            "section": "theme",
            "key": "Style",
            'options': ['Light', 'Dark']
        }, {
            "type":
            "options",
            "title":
            "Palette",
            "desc":
            "Couleurs des fenêtres",
            "section":
            "theme",
            "key":
            "Palette",
            'options': [
                "Red", "Pink", "Purple", "DeepPurple", "Indigo", "Blue",
                "LightBlue", "Cyan", "Teal", "Green", "LightGreen", "Lime",
                "Yellow", "Amber", "Orange", "DeepOrange", "Brown", "Gray",
                "BlueGray"
            ]
        }]

        config = ConfigParser()
        config.read('config.ini')

        s = Settings()
        #s.add_json_panel('My custom panel', config, 'settings_custom.json')
        #s.add_json_panel('Another panel', config, 'settings_test2.json')
        s.add_json_panel('Graphics', config, data=json.dumps(conf_graphics))
        s.add_json_panel('Theme', config, data=json.dumps(conf_theme))
        self.ids.grid_id.add_widget(s)
Exemplo n.º 5
0
Arquivo: app.py Projeto: edthedev/kivy
 def _create_settings(self):
     from kivy.uix.settings import Settings
     if self._app_settings is None:
         self._app_settings = s = Settings()
         self.build_settings(s)
         if self.use_kivy_settings:
             s.add_kivy_panel()
         s.bind(on_close=self.close_settings,
                on_config_change=self._on_config_change)
     return self._app_settings
Exemplo n.º 6
0
 def build(self):
     self.config.read(self.get_application_config())
     h = Home()
     th = TabbedPanelHeader(text='Settings')
     h.add_widget(th)
     sett = Settings()
     th.content = sett.create_json_panel('Fractal Entropy',
                                         self.config,
                                         data=mysettings.json)
     return h
Exemplo n.º 7
0
 def settings_func(self, p):
     s = Settings()
     config = ConfigParser()
     try:
         config.setdefaults('EVM', {'school': self.school, 'names': self.temp, 'post': self.post, 'p_col': self.color, 'im_path': self.im_path, "code1": self.code1, "code2": self.code2, 'number':self.number})
     except:
         config.setdefaults('EVM', {'school': 'Unknown', 'names': self.temp, 'post': "Unknown", 'p_col': 'FFFFFF', 'im_path': self.im_path, "code1": "voting", "code2": "results", 'number':self.number})
     s.add_json_panel('EVM', config, data = self.json)
     s.bind(on_config_change = self.settings_change)
     setting = Popup(title = "Settings", content = s)
     s.bind(on_close = lambda *func: self.save_settings(s))
     setting.open()
Exemplo n.º 8
0
    def build(self):
        Window.clearcolor = (228. / 255., 228. / 255., 228. / 255., 1)
        self.title = "GrunwaldCalc"

        Window.minimum_width = 300
        Window.minimum_height = 200

        self.config = ConfigParser()
        self.config.read("config.ini")
        self.config.adddefaultsection("Settings")

        self.config.setdefault("Settings", "Language",
                               locale.getdefaultlocale()[0])
        self.language = self.config.getdefault("Settings", "Language",
                                               locale.getdefaultlocale()[0])
        self.settings = Settings()
        self.day_calc = DayCalc.Calculate()
        self.date_finder = DateFinder.WikiScrape()
        self.day_calc.changeLanguage(self.language)
        self.date_finder.changeLanguage(self.language)
        self.container = BoxLayout(orientation="vertical")
        self.search_layout = BoxLayout(orientation="horizontal",
                                       size_hint=(1, 0.25),
                                       height=100)
        self.results_layout = AnchorLayout(anchor_y="top")
        self.container.add_widget(self.search_layout)
        self.container.add_widget(self.results_layout)

        try:
            with open("./languages/" + self.language + ".lang",
                      encoding="UTF-8") as language_file:
                self.language_file = json.load(language_file)
        except FileNotFoundError:
            self.language = "en_US"
            with open("./languages/" + self.language + ".lang",
                      encoding="UTF-8") as language_file:
                self.language_file = json.load(language_file)

        self.search_box = TextInput(hint_text=(self.language_file["hint"]),
                                    size_hint=(0.7, None),
                                    height=50,
                                    multiline=False)
        self.search_button = Button(text=self.language_file["button-text"],
                                    size_hint=(0.3, None),
                                    height=50)
        self.search_layout.add_widget(self.search_box)
        self.search_layout.add_widget(self.search_button)

        self.search_box.bind(on_text_validate=self.start_main)
        self.search_button.bind(on_press=self.start_main)

        return self.container
Exemplo n.º 9
0
    def build(self):

        self.frame = MainFrame()
        self._trash_can = self.frame.ids.sm.screens[
            0].ids.rightborder.ids.trash_can

        parser = ConfigParser()
        parser.read("jointbtn.ini")

        # parser.

        self._cfg = parser

        s = Settings()
        s.add_json_panel('config', parser, data=config_json)
        s.on_close = partial(self.on_screen_n, 'script', 0)

        self.frame.ids.sm.screens[1].add_widget(s)

        self.coord = 'Both'

        return self.frame
Exemplo n.º 10
0
    def generate_settings(self):

        settings_panel = Settings()  #create instance of Settings

        #        def add_one_panel(from_instance):
        #            panel = SettingsPanel(title="I like trains", settings=self)
        #            panel.add_widget(AsyncImage(source="http://i3.kym-cdn.com/entries/icons/original/000/004/795/I-LIKE-TRAINS.jpg"))
        #            settings_panel.add_widget(panel)
        #            print "Hello World from ", from_instance

        panel = SettingsPanel(
            title="Engine")  #create instance of left side panel
        item1 = SettingItem(
            panel=panel,
            title="Board")  #create instance of one item in left side panel
        item2 = SettingItem(
            panel=panel,
            title="Level")  #create instance of one item in left side panel

        #        item2 = SettingTitle(title="Level") #another widget in left side panel
        #        button = Button(text="Add one more panel")

        #        item1.add_widget(button) #add widget to item1 in left side panel
        #        button.bind(on_release=add_one_panel) #bind that button to function

        panel.add_widget(item1)  # add item1 to left side panel
        panel.add_widget(item2)  # add item2 to left side panel
        settings_panel.add_widget(
            panel)  #add left side panel itself to the settings menu

        def go_back():
            self.root.current = 'main'

        settings_panel.on_close = go_back

        return settings_panel  # show the settings interface
Exemplo n.º 11
0
 def build_settings(self, settings):
     Setting = Settings()
     settings.register_type('scrolloptions', SettingScrollOptions)        
     settings.add_json_panel('Main Settings',
                             self.config,
                             data=settings_json)
 def build(self):
     from kivy.uix.settings import Settings
     s = Settings()
     s.add_json_panel('Test Panel', self.config, data=data)
     return s
Exemplo n.º 13
0
 def build(self):
     s = Settings()
     s.add_json_panel('Test Panel', self.config, data=data)
     return s
Exemplo n.º 14
0
 def build_settings(self, settings):
     self.config = ConfigParser()
     self.settings = Settings()
     self.settings.add_json_panel('Preferences', self.config, data=SETTINGS)
Exemplo n.º 15
0
def CreateConfigPanel():
    from kivy.uix.settings import SettingsWithTabbedPanel as Settings
    settings = Settings(name='Settings')
    settings.add_json_panel('BGM', CP, filename='params.json')
    settings.add_kivy_panel()
    return settings