diff --git a/client/examples/Kivy-Dynamic-Screens-Template b/client/examples/Kivy-Dynamic-Screens-Template new file mode 160000 index 0000000..7fbab74 --- /dev/null +++ b/client/examples/Kivy-Dynamic-Screens-Template @@ -0,0 +1 @@ +Subproject commit 7fbab74c5693430ea486ac359fa7a032596c232b diff --git a/client/examples/scrollview.py b/client/examples/scrollview.py new file mode 100644 index 0000000..42ae553 --- /dev/null +++ b/client/examples/scrollview.py @@ -0,0 +1,69 @@ +from kivy.uix.scrollview import ScrollView + + +class EndEventScroll(ScrollView): + + def on_scroll_stop(self, *args, **kwargs): + result = super(EndEventScroll, self).on_scroll_stop(*args, **kwargs) + + if self.scroll_y < 0 and hasattr(self, 'on_end_event'): + self.on_end_event() + return result + + +if __name__ == '__main__': + from kivy.app import App + + from kivy.uix.gridlayout import GridLayout + from kivy.uix.button import Button + from kivy.properties import ObjectProperty + + + class CustomScrollView(EndEventScroll): + + layout1 = ObjectProperty(None) + + def on_end_event(self): + height = 0.0 + + for i in range(40): + btn = Button(text=str(i), size_hint=(None, None), + size=(200, 100)) + self.layout1.add_widget(btn) + height += btn.height + height = float(height / self.layout1.cols) + procent = (100.0 * height)/float(self.layout1.height) + self.scroll_y += procent/100.0 + + + class ScrollViewApp(App): + + def build(self): + layout1 = GridLayout(cols=4, spacing=10, size_hint=(None, None)) + layout1.bind(minimum_height=layout1.setter('height'), + minimum_width=layout1.setter('width')) + for i in range(40): + btn = Button(text=str(i), size_hint=(None, None), + size=(200, 100)) + layout1.add_widget(btn) + scrollview1 = CustomScrollView(bar_width='2dp', layout1=layout1) + scrollview1.add_widget(layout1) + + layout2 = GridLayout(cols=4, spacing=10, size_hint=(None, None)) + layout2.bind(minimum_height=layout2.setter('height'), + minimum_width=layout2.setter('width')) + for i in range(40): + btn = Button(text=str(i), size_hint=(None, None), + size=(200, 100)) + layout2.add_widget(btn) + scrollview2 = ScrollView(scroll_type=['bars'], + bar_width='9dp', + scroll_wheel_distance=100) + scrollview2.add_widget(layout2) + + root = GridLayout(cols=2) + root.add_widget(scrollview1) + root.add_widget(scrollview2) + return root + + ScrollViewApp().run() \ No newline at end of file diff --git a/client/log.txt b/client/log.txt index 8f9e3bd..9bb6afa 100644 --- a/client/log.txt +++ b/client/log.txt @@ -1 +1,40 @@ - \ No newline at end of file +testing + + +testing2 + +testing2 + + + +<__main__.MyIconButton object at 0x7f7d4ea78c78> +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +[] +{} +{} +{} +{} +{} +{} +{} +{} +{} +{} diff --git a/client/logo (copy).png b/client/logo (copy).png new file mode 100644 index 0000000..49d8081 Binary files /dev/null and b/client/logo (copy).png differ diff --git a/client/logo.png b/client/logo.png new file mode 100644 index 0000000..9f9e961 Binary files /dev/null and b/client/logo.png differ diff --git a/client/main.kv b/client/main.kv index 5523733..5327693 100644 --- a/client/main.kv +++ b/client/main.kv @@ -1,40 +1,9 @@ #:import get_color_from_hex kivy.utils.get_color_from_hex #:import images_path kivymd.images_path #:import colors kivymd.color_definitions.colors +#:import partial functools.partial +#:import NoTransition kivy.uix.screenmanager.NoTransition -ScreenManager: - BaseScreen: - FeedScreen: - -: - name: 'base' - MDToolbar: - title: "Gyre" - pos_hint: {'center_x': .5, 'center_y': 0.95} - md_bg_color: get_color_from_hex(colors['Red']['500']) - background_palette: 'Red' - background_hue: '500' - right_action_items: [['radio-tower', lambda x: x], ['camera', lambda x: x], ['play', lambda x: x]] - left_action_items: [[f"{images_path}kivymd_alpha.png", lambda x: x]] - - - MDFillRoundFlatButton: - text: "Gyre" - halign: "center" - pos_hint: {"center_x": 0.5, "center_y": 0.5} - md_bg_color: get_color_from_hex(colors['Red']['500']) - - - MDLabel: - text: "Turning and turning in the widening gyre..." - pos_hint: {"center_x": 0.5, "center_y": 0.435} - halign:"center" - - - - name: 'feed' - MDLabel: - text: "The falcon cannot hear the falconer..." - pos_hint: {"center_x": 0.5, "center_y": 0.3} - halign:"center" +MyLayout: + MyToolbar \ No newline at end of file diff --git a/client/main.py b/client/main.py index 20f6c5a..5b49ae1 100644 --- a/client/main.py +++ b/client/main.py @@ -1,34 +1,164 @@ from kivy.uix.screenmanager import Screen,ScreenManager from kivymd.app import MDApp -from kivymd.uix.button import MDFillRoundFlatButton +from kivymd.uix.button import MDFillRoundFlatButton, MDIconButton +from kivymd.uix.toolbar import MDToolbar +from kivymd.uix.screen import MDScreen from kivy.lang import Builder +from kivy.uix.boxlayout import BoxLayout +from kivymd.theming import ThemeManager +from kivy.properties import ObjectProperty,ListProperty +import time +from collections import OrderedDict +from functools import partial +from kivy.uix.screenmanager import NoTransition +from kivymd.uix.label import MDLabel +from kivy.uix.widget import Widget +root = None +app = None +def log(x): + with open('log.txt','a+') as of: + of.write(str(x)+'\n') -class BaseScreen(Screen): - pass +class MyLayout(BoxLayout): + scr_mngr = ObjectProperty(None) + #orientation = 'vertical' + + def change_screen(self, screen, *args): + self.scr_mngr.current = screen + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.orientation='vertical' + self.add_widget(MyToolbar()) + +class MyIconButton(MDIconButton): + kwargs = dict(theme_text_color='Custom',text_color=(1,0,0,1),pos_hint = {'center_y': 0.5}) + def __init__(self, screen_name, *args, **kwargs): + kwargs = dict(list(self.kwargs.items()) + list(kwargs.items())) + kwargs['on_release'] = lambda x: app.change_screen(screen_name) + super().__init__(*args, **kwargs) + +class MyLabel(MDLabel): + kwargs = dict(theme_text_color='Custom',text_color=(1,0,0,1), pos_hint = {'center_y': 0.5}) + def __init__(self, *args, **kwargs): + kwargs = dict(list(self.kwargs.items()) + list(kwargs.items())) + super().__init__(*args, **kwargs) + +class MyToolbar(MDToolbar): + + def change_screen(self,x, *args, **kwargs): + app.change_screen(x) + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.id='toolbar' + self.title='Gyre' + self.pos_hint = {'center_x': .5, 'center_y': 0.95} + self.md_bg_color = (0,0,0,1) + # self.ids['left_actions'] = left = Widget() + # self.ids['right_actions'] = right = Widget() + # self.specific_text_color = (1,0,0,1) + + + # Add icons + + self.add_widget(MyIconButton('feed', icon='radio-tower')) + self.add_widget(MyIconButton('people', icon='account-group')) + self.add_widget(MyIconButton('events', icon='calendar')) + self.add_widget(MyIconButton('messages', icon='message-processing-outline')) + self.add_widget(MyIconButton('notifications', icon='bell-outline')) + + + # def button_notif(self): + # return MyIconButton('notifications', icon='bell-outline') + + +class BaseScreen(MDScreen): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + #self.add_widget(MDLabel(text='Turning and turning in the widening gyre \nThe falcon cannot hear the falconer;\nThings fall apart; the centre cannot hold;\nMere anarchy is loosed upon the world,\nThe blood-dimmed tide is loosed, and everywhere \nThe ceremony of innocence is drowned;\nThe best lack all conviction, while the worst \nAre full of passionate intensity.\n\nSurely some revelation is at hand;\nSurely the Second Coming is at hand. \nThe Second Coming! Hardly are those words out \nWhen a vast image out of Spiritus Mundi\nTroubles my sight: somewhere in sands of the desert \nA shape with lion body and the head of a man, \nA gaze blank and pitiless as the sun, \nIs moving its slow thighs, while all about it \nReel shadows of the indignant desert birds. \nThe darkness drops again; but now I know \nThat twenty centuries of stony sleep\nWere vexed to nightmare by a rocking cradle, \nAnd what rough beast, its hour come round at last, \nSlouches towards Bethlehem to be born?')) + class FeedScreen(BaseScreen): pass +class WelcomeScreen(BaseScreen): + id='welcome' + #def on_enter(self, *args, **kwargs): + # super().on_enter() + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + # self.add_widget( + # MDFillRoundFlatButton( + # text="Hello, World", + # pos_hint={"center_x": 0.5, "center_y": 0.5}, + # ) + # ) + self.add_widget( + MyLabel( + text='Turning and turning in the widening gyre \nThe falcon cannot hear the falconer;\nThings fall apart; the centre cannot hold;\nMere anarchy is loosed upon the world,\nThe blood-dimmed tide is loosed, and everywhere \nThe ceremony of innocence is drowned;\nThe best lack all conviction, while the worst \nAre full of passionate intensity.\n\nSurely some revelation is at hand;\nSurely the Second Coming is at hand. \nThe Second Coming! Hardly are those words out \nWhen a vast image out of Spiritus Mundi\nTroubles my sight: somewhere in sands of the desert \nA shape with lion body and the head of a man, \nA gaze blank and pitiless as the sun, \nIs moving its slow thighs, while all about it \nReel shadows of the indignant desert birds. \nThe darkness drops again; but now I know \nThat twenty centuries of stony sleep\nWere vexed to nightmare by a rocking cradle, \nAnd what rough beast, its hour come round at last, \nSlouches towards Bethlehem to be born?', + halign='center' + ) + ) + pass + +class PeopleScreen(BaseScreen): + pass + +class EventsScreen(BaseScreen): + pass + +class MessagesScreen(BaseScreen): + pass +class NotificationsScreen(BaseScreen): + pass + + + class MainApp(MDApp): # def build(self): # self.theme_cls.primary_palette = "Red" # "Purple", "Red" + title = 'Gyre' def build(self): - Builder.load_file('main.kv') + global root,app + root = MyLayout() + app = self + + + + self.theme_cls = ThemeManager() + self.theme_cls.primary_palette='Red' + self.theme_cls.theme_style='Dark' + + self.screens = OrderedDict() + self.screens['welcome']=WelcomeScreen(name='welcome') + self.screens['feed']=FeedScreen(name='feed') + self.screens['people']=PeopleScreen(name='people') + self.screens['events']=EventsScreen(name='events') + self.screens['messages']=MessagesScreen(name='messages') + self.screens['notifications']=NotificationsScreen(name='notifications') + + self.sm = ScreenManager() - self.sm.add_widget(BaseScreen(name='base')) - self.sm.add_widget(FeedScreen(name='feed')) + for screen in self.screens.values(): + self.sm.add_widget(screen) + + root.add_widget(self.sm) - return self.sm + return Builder.load_file('main.kv') + return root - def go(self,x): - self.sm.current=x + def change_screen(self,x): + #log('testing2') + self.sm.switch_to(self.screens[x], transition=NoTransition()) diff --git a/client/main1.kv b/client/main1.kv new file mode 100644 index 0000000..321de96 --- /dev/null +++ b/client/main1.kv @@ -0,0 +1,102 @@ +#:import get_color_from_hex kivy.utils.get_color_from_hex +#:import images_path kivymd.images_path +#:import colors kivymd.color_definitions.colors +#:import partial functools.partial +#:import NoTransition kivy.uix.screenmanager.NoTransition + + +MyLayout: + scr_mngr: scr_mngr + orientation: 'vertical' + height: self.minimum_height + + canvas: + Color: + rgba: 0,0,0,1 #get_color_from_hex(colors['Gray']['900']) + Rectangle: + pos: self.pos + size: self.size + + + + MyToolbar: + id: toolbar + title: app.title + pos_hint: {'center_x': .5, 'center_y': 1} + md_bg_color: 0,0,0,1 + background_palette: 'Red' + background_hue: '500' + specific_text_color: 1,0,0,1 + right_action_items: [['radio-tower', partial(root.change_screen, 'feed')], ['account-group', partial(root.change_screen, 'people')], ['calendar', partial(root.change_screen, 'events')], ['message-processing-outline', partial(root.change_screen, 'messages')], ['bell-outline', partial(root.change_screen, 'notifications')]] + left_action_items: [[f"spiral3.png", partial(root.change_screen, 'welcome')]] + + ScreenManager: + id: scr_mngr + transition: NoTransition() + + + WelcomeScreen: + name: 'welcome' + + MDLabel: + text: "Turning and turning in the widening gyre \nThe falcon cannot hear the falconer;\nThings fall apart; the centre cannot hold;\nMere anarchy is loosed upon the world,\nThe blood-dimmed tide is loosed, and everywhere \nThe ceremony of innocence is drowned;\nThe best lack all conviction, while the worst \nAre full of passionate intensity.\n\nSurely some revelation is at hand;\nSurely the Second Coming is at hand. \nThe Second Coming! Hardly are those words out \nWhen a vast image out of Spiritus Mundi\nTroubles my sight: somewhere in sands of the desert \nA shape with lion body and the head of a man, \nA gaze blank and pitiless as the sun, \nIs moving its slow thighs, while all about it \nReel shadows of the indignant desert birds. \nThe darkness drops again; but now I know \nThat twenty centuries of stony sleep\nWere vexed to nightmare by a rocking cradle, \nAnd what rough beast, its hour come round at last, \nSlouches towards Bethlehem to be born?" + pos_hint: {"center_x": 0.5, "center_y": 0.5} + halign:"center" + theme_text_color: "Custom" + text_color: 1, 0, 0, 1 + + + FeedScreen: + name: 'feed' + MDLabel: + text: "FEED Turning and turning in the widening gyre..." + pos_hint: {"center_x": 0.5, "center_y": 0.95} + halign:"center" + theme_text_color: "Custom" + text_color: 1, 0, 0, 1 + + PeopleScreen: + name: 'people' + MDLabel: + text: "The falcon cannot hear the falconer..." + pos_hint: {"center_x": 0.5, "center_y": 0.95} + halign:"center" + + EventsScreen: + name: 'events' + + MessagesScreen: + name: 'messages' + + NotificationsScreen: + name: 'notifications' + +# ScreenManager: +# BaseScreen: +# FeedScreen: + + +# : +# name: 'base' + + + +# MDFillRoundFlatButton: +# text: "Gyre" +# halign: "center" +# pos_hint: {"center_x": 0.5, "center_y": 0.5} +# md_bg_color: get_color_from_hex(colors['Red']['500']) + + +# MDLabel: +# text: "Turning and turning in the widening gyre..." +# pos_hint: {"center_x": 0.5, "center_y": 0.435} +# halign:"center" + + +# +# name: 'feed' +# MDLabel: +# text: "The falcon cannot hear the falconer..." +# pos_hint: {"center_x": 0.5, "center_y": 0.3} +# halign:"center" diff --git a/client/main1.py b/client/main1.py new file mode 100644 index 0000000..fdb46ad --- /dev/null +++ b/client/main1.py @@ -0,0 +1,58 @@ +from kivy.uix.screenmanager import Screen,ScreenManager +from kivymd.app import MDApp +from kivymd.uix.button import MDFillRoundFlatButton +from kivy.lang import Builder +from kivy.uix.boxlayout import BoxLayout +from kivymd.theming import ThemeManager +from kivy.properties import ObjectProperty +from kivymd.uix.label import MDLabel + +class MyLayout(BoxLayout): + scr_mngr = ObjectProperty(None) + + def change_screen(self, screen, *args): + self.scr_mngr.current = screen + +class FeedScreen(Screen): + def on_enter(self): + with open('log.txt','a+') as of: of.write(str(dir(self))) + print(dir(self)) + #self.add_widget(MDLabel(text='hello world!')) + pass + +class WelcomeScreen(Screen): + pass + +class PeopleScreen(Screen): + pass + +class EventsScreen(Screen): + pass + +class MessagesScreen(Screen): + pass + +class NotificationsScreen(Screen): + pass + + +class MainApp(MDApp): + # def build(self): + # self.theme_cls.primary_palette = "Red" # "Purple", "Red" + title = 'Gyre' + + def build(self): + #self.theme_cls.primary_palette = "Green" # "Purple", "Red" + + Builder.load_file('main.kv') + # self.sm = ScreenManager() + # self.sm.add_widget(BaseScreen(name='base')) + # self.sm.add_widget(FeedScreen(name='feed')) + + # return self.sm + + + +if __name__ == '__main__': + App = MainApp() + App.run() diff --git a/client/spiral2.png b/client/spiral2.png new file mode 100644 index 0000000..79fe581 Binary files /dev/null and b/client/spiral2.png differ diff --git a/client/spiral2.svg b/client/spiral2.svg new file mode 100644 index 0000000..5ac386d --- /dev/null +++ b/client/spiral2.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/client/spiral3.png b/client/spiral3.png new file mode 100644 index 0000000..63e353d Binary files /dev/null and b/client/spiral3.png differ diff --git a/client/spiral3b.png b/client/spiral3b.png new file mode 100644 index 0000000..1713180 Binary files /dev/null and b/client/spiral3b.png differ diff --git a/client/spiral4.png b/client/spiral4.png new file mode 100644 index 0000000..bf86f41 Binary files /dev/null and b/client/spiral4.png differ diff --git a/client/spiral4b.png b/client/spiral4b.png new file mode 100644 index 0000000..24bd536 Binary files /dev/null and b/client/spiral4b.png differ diff --git a/client/watcher.py b/client/watcher.py index 52ac3a2..46de185 100644 --- a/client/watcher.py +++ b/client/watcher.py @@ -55,4 +55,4 @@ if __name__ == '__main__': w = Watcher() w.run() - \ No newline at end of file +