this fixes #1 and improved the code base
This commit is contained in:
13
modules/settings/appSettings/__init__.py
Normal file
13
modules/settings/appSettings/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
from .dhiraagu_settings import Settings as DhiraaguSettings
|
||||
from .medianet_settings import Settings as MedianetSettings
|
||||
from .mwsc_settings import Settings as MwscSettings
|
||||
from .ooredoo_settings import Settings as OoredooSettings
|
||||
from .stelco_settings import Settings as StelcoSettings
|
||||
|
||||
__all__ = [
|
||||
'DhiraaguSettings',
|
||||
'MedianetSettings',
|
||||
'MwscSettings',
|
||||
'OoredooSettings',
|
||||
'StelcoSettings'
|
||||
]
|
58
modules/settings/appSettings/dhiraagu_settings.py
Normal file
58
modules/settings/appSettings/dhiraagu_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
from ..functions import config
|
||||
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True,
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text('General'))
|
||||
|
||||
def _on_enable_change(e):
|
||||
print(config.getint('apps', 'dhiraagu'))
|
||||
if config.getint('apps', 'dhiraagu'):
|
||||
config.save('apps', 'dhiraagu', '0')
|
||||
else:
|
||||
config.save('apps', 'dhiraagu', '1')
|
||||
page.update()
|
||||
|
||||
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
label=' Enable this module',
|
||||
on_change=_on_enable_change,
|
||||
value=False
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
if config.getint('apps', 'dhiraagu') == 1:
|
||||
generalSettings.content.controls[0].content.content.content.value = True
|
||||
settingsContainer.controls.append(
|
||||
generalSettings,
|
||||
)
|
||||
return AppView(
|
||||
'/settings/dhiraagu',
|
||||
[
|
||||
ft.AppBar(
|
||||
leading=ft.IconButton(
|
||||
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||
on_click=lambda _: page.go('/settings'),
|
||||
),
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT,
|
||||
),
|
||||
settingsContainer,
|
||||
],
|
||||
)
|
58
modules/settings/appSettings/medianet_settings.py
Normal file
58
modules/settings/appSettings/medianet_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
from ..functions import config
|
||||
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True,
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text('General'))
|
||||
|
||||
def _on_enable_change(e):
|
||||
print(config.getint('apps', 'medianet'))
|
||||
if config.getint('apps', 'medianet'):
|
||||
config.save('apps', 'medianet', '0')
|
||||
else:
|
||||
config.save('apps', 'medianet', '1')
|
||||
page.update()
|
||||
|
||||
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
label=' Enable this module',
|
||||
on_change=_on_enable_change,
|
||||
value=False
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
if config.getint('apps', 'medianet') == 1:
|
||||
generalSettings.content.controls[0].content.content.content.value = True
|
||||
settingsContainer.controls.append(
|
||||
generalSettings,
|
||||
)
|
||||
return AppView(
|
||||
'/settings/medianet',
|
||||
[
|
||||
ft.AppBar(
|
||||
leading=ft.IconButton(
|
||||
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||
on_click=lambda _: page.go('/settings'),
|
||||
),
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT,
|
||||
),
|
||||
settingsContainer,
|
||||
],
|
||||
)
|
58
modules/settings/appSettings/mwsc_settings.py
Normal file
58
modules/settings/appSettings/mwsc_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
from ..functions import config
|
||||
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True,
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text('General'))
|
||||
|
||||
def _on_enable_change(e):
|
||||
print(config.getint('apps', 'mwsc'))
|
||||
if config.getint('apps', 'mwsc'):
|
||||
config.save('apps', 'mwsc', '0')
|
||||
else:
|
||||
config.save('apps', 'mwsc', '1')
|
||||
page.update()
|
||||
|
||||
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
label=' Enable this module',
|
||||
on_change=_on_enable_change,
|
||||
value=False
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
if config.getint('apps', 'mwsc') == 1:
|
||||
generalSettings.content.controls[0].content.content.content.value = True
|
||||
settingsContainer.controls.append(
|
||||
generalSettings,
|
||||
)
|
||||
return AppView(
|
||||
'/settings/mwsc',
|
||||
[
|
||||
ft.AppBar(
|
||||
leading=ft.IconButton(
|
||||
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||
on_click=lambda _: page.go('/settings'),
|
||||
),
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT,
|
||||
),
|
||||
settingsContainer,
|
||||
],
|
||||
)
|
58
modules/settings/appSettings/ooredoo_settings.py
Normal file
58
modules/settings/appSettings/ooredoo_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
from ..functions import config
|
||||
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True,
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text('General'))
|
||||
|
||||
def _on_enable_change(e):
|
||||
print(config.getint('apps', 'ooredoo'))
|
||||
if config.getint('apps', 'ooredoo'):
|
||||
config.save('apps', 'ooredoo', '0')
|
||||
else:
|
||||
config.save('apps', 'ooredoo', '1')
|
||||
page.update()
|
||||
|
||||
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
label=' Enable this module',
|
||||
on_change=_on_enable_change,
|
||||
value=False
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
if config.getint('apps', 'ooredoo') == 1:
|
||||
generalSettings.content.controls[0].content.content.content.value = True
|
||||
settingsContainer.controls.append(
|
||||
generalSettings,
|
||||
)
|
||||
return AppView(
|
||||
'/settings/ooredoo',
|
||||
[
|
||||
ft.AppBar(
|
||||
leading=ft.IconButton(
|
||||
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||
on_click=lambda _: page.go('/settings'),
|
||||
),
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT,
|
||||
),
|
||||
settingsContainer,
|
||||
],
|
||||
)
|
58
modules/settings/appSettings/stelco_settings.py
Normal file
58
modules/settings/appSettings/stelco_settings.py
Normal file
@ -0,0 +1,58 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
from ..functions import config
|
||||
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True,
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text('General'))
|
||||
|
||||
def _on_enable_change(e):
|
||||
print(config.getint('apps', 'stelco'))
|
||||
if config.getint('apps', 'stelco'):
|
||||
config.save('apps', 'stelco', '0')
|
||||
else:
|
||||
config.save('apps', 'stelco', '1')
|
||||
page.update()
|
||||
|
||||
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
label=' Enable this module',
|
||||
on_change=_on_enable_change,
|
||||
value=False
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
if config.getint('apps', 'stelco') == 1:
|
||||
generalSettings.content.controls[0].content.content.content.value = True
|
||||
settingsContainer.controls.append(
|
||||
generalSettings,
|
||||
)
|
||||
return AppView(
|
||||
'/settings/stelco',
|
||||
[
|
||||
ft.AppBar(
|
||||
leading=ft.IconButton(
|
||||
ft.icons.ARROW_BACK_IOS_NEW_ROUNDED,
|
||||
on_click=lambda _: page.go('/settings'),
|
||||
),
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT,
|
||||
),
|
||||
settingsContainer,
|
||||
],
|
||||
)
|
Reference in New Issue
Block a user