Renamed controller class and split signals to other file(s)

This commit is contained in:
Maxim Stewart 2019-07-05 01:44:16 -05:00
parent 8ad8e612f5
commit 701c91ecd5
7 changed files with 26 additions and 17 deletions

View File

@ -15,8 +15,7 @@ import inspect
# Application imports
from utils import Settings
from signal_classes import WebviewSignals
from Controller import Controller
from signal_classes import CrossClassSignals, WebviewSignals, GridSignals
class Main:
@ -31,7 +30,10 @@ class Main:
# Gets the methods from the classes and sets to handler.
# Then, builder connects to any signals it needs.
classes = [WebviewSignals(settings), Controller(settings)]
classes = [CrossClassSignals(settings),
WebviewSignals(settings),
GridSignals(settings)]
handlers = {}
for c in classes:
methods = inspect.getmembers(c, predicate=inspect.ismethod)

View File

@ -0,0 +1,15 @@
# Gtk imports
# Python imports
# Application imports
class CrossClassSignals:
def __init__(self, settings):
self.settings = settings
self.builder = self.settings.returnBuilder()
def closePopup(self, widget, data=None):
widget.hide()

View File

@ -8,19 +8,20 @@ from utils import Dragging
from utils import FileHandler
class Controller:
class GridSignals:
def __init__(self, settings):
self.filehandler = FileHandler()
self.settings = settings
self.builder = self.settings.returnBuilder()
self.desktop = self.builder.get_object("Desktop")
selectedDirDialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
self.desktopPath = self.settings.returnDesktopPath()
self.grid = None
# Add filter to allow only folders to be selected
selectedDirDialog = self.builder.get_object("selectedDirDialog")
filefilter = self.builder.get_object("Folders")
selectedDirDialog.add_filter(filefilter)
selectedDirDialog.set_filename(self.desktopPath)
@ -31,15 +32,6 @@ class Controller:
self.grid = Grid(self.desktop, self.settings)
self.grid.setIconViewDir(newPath)
def getWindowsOnScreen(self):
screen = self.settings.returnScren()
windowButtons = self.builder.get_object("windowButtons")
def closePopup(self, widget, data=None):
widget.hide()
# File control events
def createFile(arg):

View File

@ -1 +1,3 @@
from signal_classes.CrossClassSignals import CrossClassSignals
from signal_classes.WebviewSignals import WebviewSignals
from signal_classes.GridSignals import GridSignals

View File

@ -49,8 +49,6 @@ class Grid:
self.desktop.connect("button_press_event", self.iconRightClickEventManager, (self.desktop,))
def setIconViewDir(self, path):
self.store.clear()

Binary file not shown.