Esempio n. 1
0
 def setUp(self):
     super().setUp()
     panel = SettingsPanel()
     self.fp = SettingCustomConfigFilePath(panel=panel)
     self.fp.value = self.T.file.aname
     self.fp._create_popup(self.fp)
     self.fp.textinput.filename = self.T.filename.aname
Esempio n. 2
0
    def build_settings(self, settings):
        """
		Add our custom section to the default configuration object.
		"""
        # We use the string defined above for our JSON, but it could also b
        # loaded from a file as follows:
        #     settings.add_json_panel('My Label', self.config, 'settings.json')
        #        settings.add_json_panel('My Label', self.config, data=json)
        title = 'Sync Settings'
        settings_list = settings_master_list()
        panel = SettingsPanel(title=title,
                              settings=settings,
                              config=self.config)

        for setting in settings_list.keys():
            if settings_list[setting][0] == 'boolean':
                s = SettingBoolean(panel=panel,
                                   title=setting,
                                   section="Sync Settings",
                                   key=setting)
            elif settings_list[setting][0] == 'numeric':
                s = SettingNumeric(panel=panel,
                                   title=setting,
                                   section="Sync Settings",
                                   key=setting)
            panel.add_widget(s)


#        panel.add_widget(SettingTitle(text = 'Active Spiders'))
        uid = panel.uid
        if settings.interface is not None:
            settings.interface.add_panel(panel, title, uid)
Esempio n. 3
0
 def test_base(self):
     panel = SettingsPanel()
     self.fp = SettingLabel(panel=panel)
     self.fp.value = "some url"
     with patch("mydevoirs.custom_setting.webbrowser.open_new") as m:
         self.fp.dispatch("on_release")
         assert m.called
         assert m.call_args_list == [call("some url")]
Esempio n. 4
0
    def create_json_panel(self, title, config, filename=None, data=None):
        import settings as platform_settings
        from kivy.utils import platform

        import json
        sdata = [d for d in json.loads(data)]
        processed_data = []
        for d in sdata:
            platforms = d.get('platforms', None)
            profiles = d.get('profiles', None)
            to_add = bool(not platforms and not profiles)
            to_add |= bool(platforms and platform in platforms
                           and not profiles)
            to_add |= bool(platforms and platform in platforms
                           and platform_settings.PROFILE in profiles)

            if to_add:
                processed_data.append(d)

        panel = SettingsPanel(title=title, settings=self, config=config)

        for setting in processed_data:
            # determine the type and the class to use
            if 'type' not in setting:
                raise ValueError('One setting are missing the "type" element')
            ttype = setting['type']
            cls = self._types.get(ttype)
            if cls is None:
                raise ValueError(
                    'No class registered to handle the <%s> type' %
                    setting['type'])

            # create a instance of the class, without the type attribute
            del setting['type']
            str_settings = {}
            for key, item in setting.items():
                str_settings[str(key)] = item

            instance = cls(panel=panel, **str_settings)

            # instance created, add to the panel
            panel.add_widget(instance)

        notification_toggle = self.get_item('enable_notifications', panel)

        # needed to trigger enabling/disabling the groups after the settings panel is built
        notification_toggle.on_value(self, notification_toggle.value)
        panel.add_widget(RateUsLabel())
        panel.add_widget(VersionLabel())

        return panel
def FramePop(self):
    layout = GridLayout(cols=1, size_hint=(None, 2.5), width=700)
    layout.bind(minimum_height=layout.setter('height'))
    panel = SettingsPanel(title="Framework Mods", settings=self)
    main = BoxLayout(orientation='vertical')
    root = ScrollView(size_hint=(None, None),
                      bar_margin=-11,
                      bar_color=(47 / 255., 167 / 255., 212 / 255., 1.),
                      do_scroll_x=False)
    root.size = (600, 400)
    root.add_widget(layout)
    main.add_widget(root)
    done = Button(text='Done Choosing Options')
    main.add_widget(done)

    popup = Popup(background='atlas://images/eds/pop',
                  title='Framework Mods',
                  content=main,
                  auto_dismiss=True,
                  size_hint=(None, None),
                  size=(630, 500))
    popup.open()
Esempio n. 6
0
def BrowserPop(self):
    layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700)
    layout.bind(minimum_height=layout.setter('height'))
    panel = SettingsPanel(title="Browser Mods", settings=self)   
    main = BoxLayout(orientation = 'vertical')
    root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False)
    root.size = (600, 400)
    root.add_widget(layout)
    main.add_widget(root)
    done = Button(text ='Done Choosing Options')
    main.add_widget(done)
    if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
        fp = open("%s/BrowserSettings.smali" % (Browser), "r")
        lines = fp.readlines()
        fp.close()
        tabs = SettingItem(panel = panel, title = "Unlimited Browser Tabs",disabled=False, desc = "Allows Unlimited number of browser tabs to be open")
        for i in range(len(lines)):
            if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
                tabs_switch = Switch(active=False)
                continue
            if 'const/4 v0, 0x4' in open("%s/BrowserSettings.smali" % (Browser)).read():
                tabs_switch = Switch(active=True)
        tabs.add_widget(tabs_switch)
        layout.add_widget(tabs)
    
        def callback(instance, value):
            tabs_state(instance, value)
        tabs_switch.bind(active=callback)
    
    popup = Popup(background='atlas://images/eds/pop', title='Browser Mods', content=main, auto_dismiss=False, size_hint=(None, None), size=(630, 500))
    popup.open()

    def finish(self):
        finish_browser(self)
        popup.dismiss()
    done.bind(on_release=finish)
Esempio n. 7
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
    def cm_branch(self):
        config.read('%s/eds.ini' % Usr)
        Box = BoxLayout(orientation="vertical", spacing=10)
        base = SettingsPanel(title="", settings=self)
        btn_layout = GridLayout(cols=2, spacing=10)
        select = Button(text="Select")
        btn_layout.add_widget(select)
        cancel = Button(text='Cancel')
        btn_layout.add_widget(cancel)
        base.bind(minimum_height=base.setter('height'))

        #################################################
        # Removed branch type selection menu because I think it was useless
        # Should be the same for Aosp and CM
        # If not I can redo it.
        #################################################

        Cm7 = SettingItem(panel=base,
                          title="Cyanogenmod 7",
                          disabled=False,
                          desc="Android 2.3,  kernel 2.6.35,  Api 9-10 ")
        Cm7_radio = CheckBox(group='base', active=False)
        Cm7.add_widget(Cm7_radio)
        base.add_widget(Cm7)

        Cm9 = SettingItem(panel=base,
                          title="Cyanogenmod 9",
                          disabled=False,
                          desc="Android 4.0,  kernel 3.0.1,  Api 14-15")
        Cm9_radio = CheckBox(group='base', active=False)
        Cm9.add_widget(Cm9_radio)
        base.add_widget(Cm9)

        Cm10 = SettingItem(panel=base,
                           title="Cyanogenmod 10",
                           disabled=False,
                           desc="Android 4.1,  kernel 3.1.10,  Api 16-?")
        Cm10_radio = CheckBox(group='base', active=False)
        Cm10.add_widget(Cm10_radio)
        base.add_widget(Cm10)

        # for root widget do_scroll_y=True to enable scrolling
        root = ScrollView(size_hint=(None, None),
                          size=(525, 240),
                          do_scroll_x=False,
                          do_scroll_y=False)
        root.add_widget(base)
        Box.add_widget(root)
        Box.add_widget(btn_layout)

        ########################################
        # This should be working fine
        # Not sure if there is a better way to do this
        #########################################

        def on_checkbox(checkbox, value):
            title = Cm7.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] cm-gb"
                config.set("Source", "branch", "cm-gb")
            else:
                pass

        Cm7_radio.bind(active=on_checkbox)

        def checkbox_active(checkbox, value):
            title = Cm9.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] cm-ics"
                config.set("Source", "branch", "cm-ics")
            else:
                pass

        Cm9_radio.bind(active=checkbox_active)

        def on_active(checkbox, value):
            title = Cm10.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] cm-jb"
                config.set("Source", "branch", "cm-jb")
            else:
                pass

        Cm10_radio.bind(active=on_active)

        def set_branch(self):
            config.write()

        select.bind(on_release=set_branch)

        popup = Popup(background='atlas://images/eds/pop',
                      title='Branch Selection',
                      content=Box,
                      auto_dismiss=True,
                      size_hint=(None, None),
                      size=(550, 350))
        select.bind(on_release=popup.dismiss)
        cancel.bind(on_release=popup.dismiss)
        popup.open()
    def aosp_branch(self):
        config.read('%s/eds.ini' % Usr)
        Box = BoxLayout(orientation="vertical", spacing=10)
        base = SettingsPanel(title="", settings=self)
        btn_layout = GridLayout(cols=2, spacing=10)
        select = Button(text="Select")
        btn_layout.add_widget(select)
        cancel = Button(text='Cancel')
        btn_layout.add_widget(cancel)
        base.bind(minimum_height=base.setter('height'))

        GB = SettingItem(panel=base,
                         title="Gingerbread",
                         disabled=False,
                         desc="Android 2.3,  kernel 2.6.35,  Api 9-10 ")
        GB_radio = CheckBox(group='base', active=False)
        GB.add_widget(GB_radio)
        base.add_widget(GB)

        ICS = SettingItem(panel=base,
                          title="Ice Cream Sandwitch",
                          disabled=False,
                          desc="Android 4.0,  kernel 3.0.1,  Api 14-15")
        ICS_radio = CheckBox(group='base', active=False)
        ICS.add_widget(ICS_radio)
        base.add_widget(ICS)

        JB = SettingItem(panel=base,
                         title="Jellybean",
                         disabled=False,
                         desc="Android 4.1,  kernel 3.1.10,  Api 16-?")
        JB_radio = CheckBox(group='base', active=False)
        JB.add_widget(JB_radio)
        base.add_widget(JB)

        # for root widget do_scroll_y=True to enable scrolling
        root = ScrollView(size_hint=(None, None),
                          size=(525, 240),
                          do_scroll_x=False,
                          do_scroll_y=False)
        root.add_widget(base)
        Box.add_widget(root)
        Box.add_widget(btn_layout)

        ########################################
        # This should be working fine
        # Not sure if there is a better way to do this
        #########################################

        def on_checkbox(checkbox, value):
            title = GB.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] aosp-gb"
                config.set("Source", "branch", "aosp-gb")
            else:
                pass

        GB_radio.bind(active=on_checkbox)

        def checkbox_active(checkbox, value):
            title = ICS.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] aosp-ics"
                config.set("Source", "branch", "aosp-ics")
            else:
                pass

        ICS_radio.bind(active=checkbox_active)

        def on_active(checkbox, value):
            title = JB.title
            if value:
                bra.text = "[b][color=#adadad]Current Branch =[/color][/b] aosp-jb"
                config.set("Source", "branch", "aosp-jb")
            else:
                pass

        JB_radio.bind(active=on_active)

        def set_branch(self):
            config.write()

        select.bind(on_release=set_branch)

        popup = Popup(background='atlas://images/eds/pop',
                      title='Branch Selection',
                      content=Box,
                      auto_dismiss=True,
                      size_hint=(None, None),
                      size=(550, 350))
        select.bind(on_release=popup.dismiss)
        cancel.bind(on_release=popup.dismiss)
        popup.open()
Esempio n. 10
0
def MmsPop(self):
    layout = GridLayout(cols=1, size_hint=(None, 1.0), width=700)
    layout.bind(minimum_height=layout.setter('height'))
    panel = SettingsPanel(title="Mms Mods", settings=self)
    main = BoxLayout(orientation='vertical')
    root = ScrollView(size_hint=(None, None),
                      bar_margin=-11,
                      bar_color=(47 / 255., 167 / 255., 212 / 255., 1.),
                      do_scroll_x=False)
    root.size = (600, 400)
    root.add_widget(layout)
    main.add_widget(root)
    done = Button(text='Done Choosing Options')
    main.add_widget(done)
    if """    .line 77
    const/4 v0, 0x1

    sput-boolean v0, Lcom/android/mms/model/ImageModel;->mCheckResolution:Z""" in open(
            "%s/ImageModel.smali" % (Mms)).read():
        fp = open("%s/ImageModel.smali" % (Mms), "r")
        lines = fp.readlines()
        fp.close()
        comp = SettingItem(panel=panel,
                           title="Remove Mms Compression",
                           disabled=False,
                           desc="Disables Compression of Mms Messages")
        for i in range(len(lines)):
            if """    .line 77
    const/4 v0, 0x1

    sput-boolean v0, Lcom/android/mms/model/ImageModel;->mCheckResolution:Z""" in open(
                    "%s/ImageModel.smali" % (Mms)).read():
                comp_switch = Switch(active=False)
                continue
            if """    .line 77
    const/4 v0, 0x1

    sput-boolean v0, Lcom/android/mms/model/ImageModel;->mCheckResolution:Z""" in open(
                    "%s/ImageModel.smali" % (Mms)).read():
                comp_switch = Switch(active=True)
        comp.add_widget(comp_switch)
        layout.add_widget(comp)

        def callback(instance, value):
            comp_state(instance, value)

        comp_switch.bind(active=callback)

    popup = Popup(background='atlas://images/eds/pop',
                  title='Mms Mods',
                  content=main,
                  auto_dismiss=False,
                  size_hint=(None, None),
                  size=(630, 500))
    popup.open()

    def finish(self):
        finish_comp(self)
        popup.dismiss()

    done.bind(on_release=finish)
Esempio n. 11
0
def credits_popup(self):
    layout = GridLayout(cols=1, size_hint=(None, 1.4), width=700)
    layout.bind(minimum_height=layout.setter('height'))
    panel = SettingsPanel(title="Credits", settings=self)   
    main = BoxLayout(orientation = 'vertical')
    root = ScrollView(size_hint=(None, None),bar_margin=-11, bar_color=(47 / 255., 167 / 255., 212 / 255., 1.), do_scroll_x=False)
    root.size = (600, 400)
    root.add_widget(layout)
    main.add_widget(root)
    done = Button(text ='Close')
    main.add_widget(done)

    wes_btns = GridLayout(cols=3, spacing=10, padding=5)
    wes_twit = CustomButton(text='Twitter', size_hint_x=None, size_hint_y=30, width=60)
    wes_btns.add_widget(wes_twit)
    wes_contact = CustomButton(text='Gmail', size_hint_x=None, size_hint_y=30, width=60)
    wes_btns.add_widget(wes_contact)
    wes_site = CustomButton(text='Site', size_hint_x=None, size_hint_y=30, width=60)
    wes_btns.add_widget(wes_site)

    wes = SettingItem(panel = panel, title = "Wes342",disabled=False, desc = "Lead Developer:  -  Python,  xml,  java,  smali,  json\nLead Site Maintainer: - Html,  Xml,  Php")
    wes.add_widget(wes_btns)
    layout.add_widget(wes)

    sac_btns = GridLayout(cols=3, spacing=10, padding=5)
    sac_twit = CustomButton(text='Twitter',size_hint_x=None, size_hint_y=60, width=60)
    sac_btns.add_widget(sac_twit)
    sac_contact = CustomButton(text='Gmail',size_hint_x=None, size_hint_y=60, width=60)
    sac_btns.add_widget(sac_contact)
    sac_site = CustomButton(text='Site',size_hint_x=None, size_hint_y=60, width=60)
    sac_btns.add_widget(sac_site)
    
    zar_btns = GridLayout(cols=3, spacing=10, padding=5)
    zar_twit = CustomButton(text='Twitter',size_hint_x=None, size_hint_y=60, width=60)
    zar_btns.add_widget(zar_twit)
    zar_contact = CustomButton(text='Gmail',size_hint_x=None, size_hint_y=60, width=60)
    zar_btns.add_widget(zar_contact)
    zar_site = CustomButton(text='Site',size_hint_x=None, size_hint_y=60, width=60)
    zar_btns.add_widget(zar_site)

    sac = SettingItem(panel = panel, title = "Sac23",disabled=False, desc = "Lead Developer:  -  Android,  xml,  smali")
    sac.add_widget(sac_btns)
    layout.add_widget(sac)

    zar = SettingItem(panel = panel, title = "Zarboz",disabled=False, desc = "Kernel Development:  -  Source, Make, Github")
    zar.add_widget(zar_btns)
    layout.add_widget(zar)
   
   
    thanks = SettingItem(panel = panel, title = "Credits",disabled=True, desc = Credits)
    layout.add_widget(thanks)
    
    donors = SettingItem(panel = panel, title = "Donors",disabled=True, desc = Donors)
    layout.add_widget(donors)

    popup = Popup(background='atlas://images/eds/pop', title='Credits', content=main, auto_dismiss=True, size_hint=(None, None), size=(630, 500))
    popup.open()
    done.bind(on_release=popup.dismiss)

    def wes_twitter(self):
        webbrowser.open('http://twitter.com/wes342')
    wes_twit.bind(on_press=wes_twitter)
    
    def wes_gtalk(self):
        webbrowser.open("mailto:[email protected]")
    wes_contact.bind(on_press=wes_gtalk)
    
    def wes_website(self):
        webbrowser.open('http://easydevstudio.com/home')
    wes_site.bind(on_press=wes_website)
       
    def sac_twitter(self):
        webbrowser.open('http://twitter.com/sac232')
    sac_twit.bind(on_press=sac_twitter)

    def sac_gtalk(self):
        webbrowser.open("mailto:[email protected]")
    sac_contact.bind(on_press=sac_gtalk)
    
    def sac_website(self):
        webbrowser.open('http://citycollisioncenter.com')
    sac_site.bind(on_press=sac_website)
    
    def zar_twitter(self):
        webbrowser.open('http://twitter.com/zarboz')
    zar_twit.bind(on_press=zar_twitter)

    def zar_gtalk(self):
        webbrowser.open("mailto:[email protected]")
    zar_contact.bind(on_press=zar_gtalk)
    
    def zar_website(self):
        webbrowser.open('https://github.com/zarboz')
    zar_site.bind(on_press=zar_website)