Changed settings calls

This commit is contained in:
Maxim Stewart 2019-06-09 16:33:47 -05:00
parent a675ed05f7
commit f32769ba30
11 changed files with 56 additions and 68 deletions

Binary file not shown.

View File

@ -14,16 +14,14 @@ from utils import Settings, Events
class Main:
def __init__(self):
# Needed for glade file load to work right...
webkit.WebView()
webkit.WebView() # Needed for glade file to load...
self.builder = gtk.Builder()
self.settings = Settings()
self.settings.attachBuilder(self.builder)
self.builder.connect_signals(Events(self.builder, self.settings))
self.builder.connect_signals(Events(self.settings))
window = self.settings.createWindow()
window.fullscreen()
window.show_all()

View File

@ -6,7 +6,7 @@ gi.require_version('Gdk', '3.0')
from gi.repository import Gdk as gdk
# Python imports
import os, threading
import threading
from .Grid import Grid
from .Dragging import Dragging
from threading import Thread
@ -14,13 +14,13 @@ from threading import Thread
gdk.threads_init()
class Events:
def __init__(self, builder, settings):
self.builder = builder
def __init__(self, settings):
self.settings = settings
self.builder = self.settings.returnBuilder()
self.desktop = self.builder.get_object("Desktop")
self.webview = self.builder.get_object("webview")
self.desktopPath = self.settings.returnDesktopPath()
self.webview = self.builder.get_object("webview")
self.settings.setDefaultWebviewSettings(self.webview, self.webview.get_settings())
self.webview.load_uri(self.settings.returnWebHome())

View File

@ -63,7 +63,7 @@ class Grid:
loadProgress.set_fraction(0.0)
self.clearGrid(self.desktop)
for file in files:
eveBox = Icon().createIcon(dirPath, file)
eveBox = Icon(self.settings).createIcon(dirPath, file)
# self.drag.connectEvents(self.desktop, eveBox)
eveBox.connect("button_press_event", self.iconClickEventManager, (eveBox,))
eveBox.connect("enter_notify_event", self.settings.mouseOver, ())

View File

@ -13,13 +13,12 @@ from os.path import isdir, isfile, join
class Icon:
def __init__(self):
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
self.iconContainerWxH = [128, -1]
self.systemIconImageWxH = [72, 72]
self.viIconWxH = [128, -1]
self.usrHome = os.path.expanduser('~')
def __init__(self, settings):
self.usrHome = settings.returnUserHome()
self.GTK_ORIENTATION = settings.returnIconImagePos()
self.iconContainerWxH = settings.returnContainerWH()
self.systemIconImageWxH = settings.returnSystemIconImageWH()
self.viIconWxH = settings.returnVIIconWH()
def createIcon(self, dir, file):
fullPathFile = dir + "/" + file

View File

@ -22,6 +22,10 @@ class Settings:
self.desktopPath = self.usrHome + "/Desktop"
self.ColumnSize = 10
self.webHome = 'http://webfm.com/'
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
self.iconContainerWxH = [128, -1]
self.systemIconImageWxH = [72, 72]
self.viIconWxH = [128, -1]
def attachBuilder(self, builder):
@ -63,23 +67,16 @@ class Settings:
return monitors
def returnBuilder(self):
return self.builder
def returnUserHome(self):
return self.usrHome
def returnDesktopPath(self):
return self.usrHome + "/Desktop"
def returnColumnSize(self):
return self.ColumnSize
def returnWebHome(self):
return self.webHome
def isHideHiddenFiles(self):
return self.hideHiddenFiles
def returnBuilder(self): return self.builder
def returnUserHome(self): return self.usrHome
def returnDesktopPath(self): return self.usrHome + "/Desktop"
def returnColumnSize(self): return self.ColumnSize
def returnIconImagePos(self): return self.GTK_ORIENTATION
def returnContainerWH(self): return self.iconContainerWxH
def returnSystemIconImageWH(self): return self.systemIconImageWxH
def returnVIIconWH(self): return self.viIconWxH
def returnWebHome(self): return self.webHome
def isHideHiddenFiles(self): return self.hideHiddenFiles
def mouseOver(self, widget, eve, args):
hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)

View File

@ -14,16 +14,14 @@ from utils import Settings, Events
class Main:
def __init__(self):
# Needed for glade file load to work right...
webkit.WebView()
webkit.WebView() # Needed for glade file to load...
self.builder = gtk.Builder()
self.settings = Settings()
self.settings.attachBuilder(self.builder)
self.builder.connect_signals(Events(self.builder, self.settings))
self.builder.connect_signals(Events(self.settings))
window = self.settings.createWindow()
window.fullscreen()
window.show_all()

View File

@ -6,7 +6,7 @@ gi.require_version('Gdk', '3.0')
from gi.repository import Gdk as gdk
# Python imports
import os, threading
import threading
from .Grid import Grid
from .Dragging import Dragging
from threading import Thread
@ -14,13 +14,13 @@ from threading import Thread
gdk.threads_init()
class Events:
def __init__(self, builder, settings):
self.builder = builder
def __init__(self, settings):
self.settings = settings
self.builder = self.settings.returnBuilder()
self.desktop = self.builder.get_object("Desktop")
self.webview = self.builder.get_object("webview")
self.desktopPath = self.settings.returnDesktopPath()
self.webview = self.builder.get_object("webview")
self.settings.setDefaultWebviewSettings(self.webview, self.webview.get_settings())
self.webview.load_uri(self.settings.returnWebHome())

View File

@ -63,7 +63,7 @@ class Grid:
loadProgress.set_fraction(0.0)
self.clearGrid(self.desktop)
for file in files:
eveBox = Icon().createIcon(dirPath, file)
eveBox = Icon(self.settings).createIcon(dirPath, file)
# self.drag.connectEvents(self.desktop, eveBox)
eveBox.connect("button_press_event", self.iconClickEventManager, (eveBox,))
eveBox.connect("enter_notify_event", self.settings.mouseOver, ())

View File

@ -13,13 +13,12 @@ from os.path import isdir, isfile, join
class Icon:
def __init__(self):
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
self.iconContainerWxH = [128, -1]
self.systemIconImageWxH = [72, 72]
self.viIconWxH = [128, -1]
self.usrHome = os.path.expanduser('~')
def __init__(self, settings):
self.usrHome = settings.returnUserHome()
self.GTK_ORIENTATION = settings.returnIconImagePos()
self.iconContainerWxH = settings.returnContainerWH()
self.systemIconImageWxH = settings.returnSystemIconImageWH()
self.viIconWxH = settings.returnVIIconWH()
def createIcon(self, dir, file):
fullPathFile = dir + "/" + file

View File

@ -22,6 +22,10 @@ class Settings:
self.desktopPath = self.usrHome + "/Desktop"
self.ColumnSize = 10
self.webHome = 'http://webfm.com/'
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
self.iconContainerWxH = [128, -1]
self.systemIconImageWxH = [72, 72]
self.viIconWxH = [128, -1]
def attachBuilder(self, builder):
@ -63,23 +67,16 @@ class Settings:
return monitors
def returnBuilder(self):
return self.builder
def returnUserHome(self):
return self.usrHome
def returnDesktopPath(self):
return self.usrHome + "/Desktop"
def returnColumnSize(self):
return self.ColumnSize
def returnWebHome(self):
return self.webHome
def isHideHiddenFiles(self):
return self.hideHiddenFiles
def returnBuilder(self): return self.builder
def returnUserHome(self): return self.usrHome
def returnDesktopPath(self): return self.usrHome + "/Desktop"
def returnColumnSize(self): return self.ColumnSize
def returnIconImagePos(self): return self.GTK_ORIENTATION
def returnContainerWH(self): return self.iconContainerWxH
def returnSystemIconImageWH(self): return self.systemIconImageWxH
def returnVIIconWH(self): return self.viIconWxH
def returnWebHome(self): return self.webHome
def isHideHiddenFiles(self): return self.hideHiddenFiles
def mouseOver(self, widget, eve, args):
hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)