Browse Source

Run import optimiser and clear some formatting issues.

Godzil 5 years ago
parent
commit
e2fee8fa5c

+ 4 - 7
sys.py/GdUI/__init__.py

@@ -1,16 +1,13 @@
 __all__ = ["Widget", "label", "image_manager", "container", "screen", "font_manager", "image", "flow_container"]
 
-import pygame
-
-from . import widget
 from . import container
-from . import label
-from . import screen
-from . import image
 from . import flow_container
-
 from . import font_manager as FontManager
+from . import image
 from . import image_manager as ImageManager
+from . import label
+from . import screen
+from . import widget
 
 Widget = widget.Widget
 Label = label.Label

+ 1 - 0
sys.py/GdUI/container.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import pygame
+
 from .widget import Widget
 
 

+ 2 - 2
sys.py/GdUI/flow_container.py

@@ -1,8 +1,9 @@
 # -*- coding: utf-8 -*-
 
 import pygame
-from .widget import Widget
+
 from .container import Container
+from .widget import Widget
 
 
 class FlowContainer(Container):
@@ -64,4 +65,3 @@ class FlowContainer(Container):
             c.Draw()
 
         self._Parent.get_canvas().blit(self._Canvas, self._Rect)
-

+ 4 - 2
sys.py/GdUI/font_manager.py

@@ -7,7 +7,8 @@ __font_files = {}
 __fonts = {}
 __initialized = False
 
-def add_fontfile(name: str, ttffile: str,):
+
+def add_fontfile(name: str, ttffile: str, ):
     global __font_files
     __font_files[name] = ttffile
 
@@ -41,8 +42,9 @@ def get_font(fontname: str):
             print("WARN: FontManager - Trying to load '{font}' but not TTF defined for it.".format(font=fontname))
             return __fonts["default"]
 
+
 if __initialized is False:
     # Load default font
     add_fontfile("default", "fonts/VarelaRound-Regular.ttf")
     set_font("default", "default_12")
-    __initialized = True
+    __initialized = True

+ 1 - 1
sys.py/GdUI/image.py

@@ -1,8 +1,8 @@
 # -*- coding: utf-8 -*-
 
-import pygame
 from .widget import Widget
 
+
 class Image(Widget):
     def __init__(self, x=0, y=0, width=1, height=1, bg_color=None, image=None, auto_resize=True):
         super().__init__(x=x, y=y, width=width, height=height, bg_color=bg_color)

+ 1 - 1
sys.py/GdUI/image_manager.py

@@ -37,4 +37,4 @@ def del_image(name: str):
     try:
         __images[name] = None
     except KeyError:
-        print("WARN: ImageManager': Trying to remove image '{name}' which was not defined".format(name=name))
+        print("WARN: ImageManager': Trying to remove image '{name}' which was not defined".format(name=name))

+ 1 - 1
sys.py/GdUI/label.py

@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
-from .widget import Widget
 from . import font_manager
+from .widget import Widget
 
 
 class Label(Widget):

+ 1 - 0
sys.py/GdUI/screen.py

@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 import pygame
+
 from .container import Container
 
 

+ 2 - 1
sys.py/GdUI/widget.py

@@ -1,5 +1,6 @@
 import pygame
 
+
 class Widget:
     borderTop = 1
     borderBottom = 2
@@ -79,4 +80,4 @@ class Widget:
         pass
 
     def reload(self):
-        pass
+        pass

+ 2 - 1
sys.py/config_manager.py

@@ -24,6 +24,7 @@ __DEFAULT_VALUE = """{
 __config_list = {}
 __initialized = False
 
+
 def load_config(name="config.json"):
     global __data
     try:
@@ -50,4 +51,4 @@ def get(key):
 
 if __initialized == False:
     load_config("config.json")
-    __initialized = True
+    __initialized = True

+ 0 - 0
sys.py/interface/__init__.py


+ 3 - 7
sys.py/interface/foot_bar.py

@@ -1,18 +1,15 @@
-import pygame
-
-import config_manager as config
-import skin_manager as SkinManager
 import GdUI as UI
+import skin_manager as SkinManager
 
 
 class FootBar(UI.FlowContainer):
     def __init__(self, width, height):
-        super().__init__(x=0, y=height-20, width=width, height=20)
+        super().__init__(x=0, y=height - 20, width=width, height=20)
 
         self.set_bgcolor(SkinManager.get_color("white"))
 
         self._topline = UI.Widget(x=0, y=0, width=width, height=1,
-                                       bg_color=SkinManager.get_color("line"))
+                                  bg_color=SkinManager.get_color("line"))
 
         self.add_child(self._topline)
 
@@ -65,4 +62,3 @@ class FootBar(UI.FlowContainer):
     def reload(self):
         # Do nothing for now, later reload info from skinmanager
         pass
-

+ 5 - 9
sys.py/interface/main_screen.py

@@ -1,12 +1,8 @@
-import pygame
-
-import config_manager as config
-import skin_manager as SkinManager
 import GdUI as UI
-
-from . import top_bar
-from . import screen_corners
+import skin_manager as SkinManager
 from . import foot_bar
+from . import screen_corners
+from . import top_bar
 
 
 class MainScreen(UI.Container):
@@ -18,7 +14,7 @@ class MainScreen(UI.Container):
 
         self._ScreenCorners = screen_corners.ScreenCorners(width, height)
 
-        self._AppletContainer = UI.Container(x=0, y=25, width=width, height=height-25-20,
+        self._AppletContainer = UI.Container(x=0, y=25, width=width, height=height - 25 - 20,
                                              bg_color=SkinManager.get_color("bgcolor"))
 
         self.add_child(self._AppletContainer)
@@ -38,4 +34,4 @@ class MainScreen(UI.Container):
         pass
 
     def Draw(self):
-        super().Draw()
+        super().Draw()

+ 0 - 4
sys.py/interface/screen_corners.py

@@ -1,7 +1,3 @@
-import pygame
-
-import config_manager as config
-import skin_manager as SkinManager
 import GdUI as UI
 
 

+ 1 - 5
sys.py/interface/top_bar.py

@@ -1,8 +1,5 @@
-import pygame
-
-import config_manager as config
-import skin_manager as SkinManager
 import GdUI as UI
+import skin_manager as SkinManager
 
 
 class TopBar(UI.FlowContainer):
@@ -26,4 +23,3 @@ class TopBar(UI.FlowContainer):
     def reload(self):
         # Do nothing for now, later reload info from skinmanager
         pass
-

+ 4 - 3
sys.py/skin_manager.py

@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
+import configparser
 import os
 import sys
-import configparser
 
-import config_manager as config
 import GdUI as UI
+import config_manager as config
 
 __Colors = {}
 __name = "default"
@@ -18,6 +18,7 @@ __SKIN_CFG_COLORS_TAG = "Colors"
 __SKIN_CFG_FONTS_TAG = "Fonts"
 __SKIN_CFG_IMAGES_TAG = "Images"
 
+
 def __convert_html_color(hexstr):
     h = hexstr.lstrip('#')
     return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))
@@ -83,7 +84,7 @@ def load_skin(name="default"):
 
         for image in config_images:
             UI.ImageManager.add_image(image, os.path.join(skin_folder, __SKIN_IMAGE_FOLDER,
-                                                            cfg.get(__SKIN_CFG_IMAGES_TAG, image)))
+                                                          cfg.get(__SKIN_CFG_IMAGES_TAG, image)))
 
 
 def get_color(name: str):

+ 0 - 1
sys.py/start_ui.py

@@ -63,7 +63,6 @@ def init():
         print("This pygame does not support PNG")
         sys.exit()
 
-
     main_loop()
 
 

+ 1 - 4
sys.py/test_ui.py

@@ -2,7 +2,6 @@
 # -*- coding: utf-8 -*-
 
 import os
-import socket
 import sys
 
 import pygame
@@ -117,10 +116,9 @@ def main_loop():
         if x > 320:
             x = 0
         y += 1
-        while(y > 240):
+        while (y > 240):
             y = y * 2 / 240
 
-
     # socket_thread(main_screen)
 
 
@@ -132,7 +130,6 @@ def init():
         print("This pygame does not support PNG")
         sys.exit()
 
-
     main_loop()