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: class Main:
def __init__(self): def __init__(self):
# Needed for glade file load to work right... webkit.WebView() # Needed for glade file to load...
webkit.WebView()
self.builder = gtk.Builder() self.builder = gtk.Builder()
self.settings = Settings() self.settings = Settings()
self.settings.attachBuilder(self.builder) 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 = self.settings.createWindow()
window.fullscreen() window.fullscreen()
window.show_all() window.show_all()

View File

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

View File

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

View File

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

View File

@ -22,6 +22,10 @@ class Settings:
self.desktopPath = self.usrHome + "/Desktop" self.desktopPath = self.usrHome + "/Desktop"
self.ColumnSize = 10 self.ColumnSize = 10
self.webHome = 'http://webfm.com/' 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): def attachBuilder(self, builder):
@ -63,23 +67,16 @@ class Settings:
return monitors return monitors
def returnBuilder(self): def returnBuilder(self): return self.builder
return self.builder def returnUserHome(self): return self.usrHome
def returnDesktopPath(self): return self.usrHome + "/Desktop"
def returnUserHome(self): def returnColumnSize(self): return self.ColumnSize
return self.usrHome def returnIconImagePos(self): return self.GTK_ORIENTATION
def returnContainerWH(self): return self.iconContainerWxH
def returnDesktopPath(self): def returnSystemIconImageWH(self): return self.systemIconImageWxH
return self.usrHome + "/Desktop" def returnVIIconWH(self): return self.viIconWxH
def returnWebHome(self): return self.webHome
def returnColumnSize(self): def isHideHiddenFiles(self): return self.hideHiddenFiles
return self.ColumnSize
def returnWebHome(self):
return self.webHome
def isHideHiddenFiles(self):
return self.hideHiddenFiles
def mouseOver(self, widget, eve, args): def mouseOver(self, widget, eve, args):
hand_cursor = gdk.Cursor(gdk.CursorType.HAND2) hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,10 @@ class Settings:
self.desktopPath = self.usrHome + "/Desktop" self.desktopPath = self.usrHome + "/Desktop"
self.ColumnSize = 10 self.ColumnSize = 10
self.webHome = 'http://webfm.com/' 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): def attachBuilder(self, builder):
@ -63,23 +67,16 @@ class Settings:
return monitors return monitors
def returnBuilder(self): def returnBuilder(self): return self.builder
return self.builder def returnUserHome(self): return self.usrHome
def returnDesktopPath(self): return self.usrHome + "/Desktop"
def returnUserHome(self): def returnColumnSize(self): return self.ColumnSize
return self.usrHome def returnIconImagePos(self): return self.GTK_ORIENTATION
def returnContainerWH(self): return self.iconContainerWxH
def returnDesktopPath(self): def returnSystemIconImageWH(self): return self.systemIconImageWxH
return self.usrHome + "/Desktop" def returnVIIconWH(self): return self.viIconWxH
def returnWebHome(self): return self.webHome
def returnColumnSize(self): def isHideHiddenFiles(self): return self.hideHiddenFiles
return self.ColumnSize
def returnWebHome(self):
return self.webHome
def isHideHiddenFiles(self):
return self.hideHiddenFiles
def mouseOver(self, widget, eve, args): def mouseOver(self, widget, eve, args):
hand_cursor = gdk.Cursor(gdk.CursorType.HAND2) hand_cursor = gdk.Cursor(gdk.CursorType.HAND2)