Integrating controls

This commit is contained in:
Maxim Stewart 2019-07-05 14:34:15 -05:00
parent 701c91ecd5
commit 55d2bc9cd1
9 changed files with 215 additions and 363 deletions

View File

@ -3,11 +3,9 @@
# Gtk imports
import gi, faulthandler, signal
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import WebKit2 as webkit
from gi.repository import GLib
# Python imports
@ -15,14 +13,13 @@ import inspect
# Application imports
from utils import Settings
from signal_classes import CrossClassSignals, WebviewSignals, GridSignals
from signal_classes import CrossClassSignals, GridSignals
class Main:
def __init__(self):
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
faulthandler.enable() # For better debug info
webkit.WebView() # Need one initialized for webview to work from glade file
builder = gtk.Builder()
settings = Settings()
@ -31,7 +28,6 @@ class Main:
# Gets the methods from the classes and sets to handler.
# Then, builder connects to any signals it needs.
classes = [CrossClassSignals(settings),
WebviewSignals(settings),
GridSignals(settings)]
handlers = {}

View File

@ -2,123 +2,11 @@
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="webkit2gtk" version="2.12"/>
<object class="GtkFileFilter" id="Folders">
<mime-types>
<mime-type>inode/directory</mime-type>
</mime-types>
</object>
<object class="GtkWindow" id="iconControlsWindow">
<property name="can_focus">False</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="decorated">False</property>
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEntry" id="iconRenameInput">
<property name="width_request">300</property>
<property name="height_request">26</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_stock">gtk-edit</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton">
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-cut</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-paste</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">65</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="webDropDown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Show Mini Webbrowser</property>
<property name="stock">gtk-go-down</property>
<property name="icon_size">3</property>
</object>
<object class="GtkWindow" id="Window">
<property name="can_focus">False</property>
<property name="default_width">800</property>
@ -140,21 +28,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="popOutBttn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">webDropDown</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="showWebview" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
<placeholder/>
</child>
<child>
<child type="center">
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -169,38 +45,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="searDir">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="controlsBttn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="use_popover">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -238,30 +82,48 @@
</object>
</child>
</object>
<object class="GtkPopover" id="webViewer">
<object class="GtkWindow" id="iconControlsWindow">
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="relative_to">popOutBttn</property>
<property name="position">bottom</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="decorated">False</property>
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkEntry" id="iconRenameInput">
<property name="width_request">300</property>
<property name="height_request">26</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_stock">gtk-edit</property>
<signal name="key-release-event" handler="updateFile" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton">
<property name="label">gtk-home</property>
<property name="label">gtk-copy</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="loadHome" swapped="no"/>
<signal name="clicked" handler="copy" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -271,13 +133,13 @@
</child>
<child>
<object class="GtkButton">
<property name="label">gtk-refresh</property>
<property name="label">gtk-cut</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="refreshPage" swapped="no"/>
<signal name="clicked" handler="cut" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -286,34 +148,38 @@
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="webviewSearch">
<object class="GtkButton">
<property name="label">gtk-paste</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
<signal name="key-release-event" handler="runSearchWebview" swapped="no"/>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="paste" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="WebKitWebView" id="webview">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="load-changed" handler="setUrlBar" swapped="no"/>
<child>
<placeholder/>
<object class="GtkButton">
<property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="margin_left">65</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="deleteFiles" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>

View File

@ -10,16 +10,19 @@ from utils import FileHandler
class GridSignals:
def __init__(self, settings):
self.filehandler = FileHandler()
self.settings = settings
self.filehandler = FileHandler(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
self.desktopPath = self.settings.returnDesktopPath()
self.copyCutArry = []
self.selectedFiles = []
self.grid = None
self.currentPath = ""
# Add filter to allow only folders to be selected
selectedDirDialog.add_filter(filefilter)
@ -27,6 +30,7 @@ class GridSignals:
self.setIconViewDir(selectedDirDialog)
def setIconViewDir(self, widget, data=None):
newPath = widget.get_filename()
self.grid = Grid(self.desktop, self.settings)
@ -37,32 +41,38 @@ class GridSignals:
def createFile(arg):
pass
def updateFile(self, file):
if len(self.selectedFiles) == 1:
newName = self.currentPath + "/" + file
status = self.filehandler.updateFile(self.selectedFiles[0], newName)
def updateFile(self, widget, data):
if data.keyval == 65293: # Enter key press
self.getGridInfo()
file = widget.get_text();
if len(self.selectedFiles) == 1:
newName = self.currentPath + "/" + file
status = self.filehandler.updateFile(self.selectedFiles[0], newName)
print("Old Name: " + self.selectedFiles[0])
print("New Name: " + newName)
if status == 0:
self.selectedFiles = [newName]
self.setIconViewDir(self.currentPath)
if status == 0:
self.selectedFiles = [newName]
self.grid.setIconViewDir(self.currentPath)
def deleteFiles(self):
if len(self.selectedFiles) == 1:
status = self.filehandler.deleteFile(self.selectedFiles[0])
def deleteFiles(self, widget):
self.getGridInfo()
status = self.filehandler.deleteFiles(self.selectedFiles)
if status == 0:
self.selectedFiles = []
self.setIconViewDir(self.currentPath)
elif len(self.selectedFiles) > 1:
pass
if status == 0:
self.selectedFiles = []
self.grid.setIconViewDir(self.currentPath)
def copy(self):
self.copyCutArry = self.grid.returnSelectedFiles()
def copyFile(self):
pass
def cut(self):
self.copyCutArry = self.grid.returnSelectedFiles()
def cutFile(self):
pass
def paste(self):
self.currentPath = self.grid.returnCurrentPath()
def pasteFile(self):
pass
def getGridInfo(self):
self.selectedFiles = self.grid.returnSelectedFiles()
self.currentPath = self.grid.returnCurrentPath()

View File

@ -1,37 +0,0 @@
# Gtk imports
# Python imports
# Application imports
class WebviewSignals:
def __init__(self, settings):
settings = settings
builder = settings.returnBuilder()
self.webview = builder.get_object("webview")
self.webViewer = builder.get_object("webViewer")
self.webviewSearch = builder.get_object("webviewSearch")
self.homePage = settings.returnWebHome()
settings.setDefaultWebviewSettings(self.webview, self.webview.get_settings())
self.webview.load_uri(self.homePage)
# Webview events
def showWebview(self, widget):
self.webViewer.popup()
def loadHome(self, widget):
self.webview.load_uri(self.homePage)
def runSearchWebview(self, widget, data=None):
if data.keyval == 65293:
self.webview.load_uri(widget.get_text().strip())
def refreshPage(self, widget, data=None):
self.webview.load_uri(self.webview.get_uri())
def setUrlBar(self, widget, data=None):
self.webviewSearch.set_text(widget.get_uri())

View File

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

View File

@ -12,25 +12,29 @@ def threaded(fn):
return wrapper
class FileHandler:
def __init__(self):
def __init__(self, settings):
# 'Filters'
self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx' '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf')
self.vids = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
self.txt = ('.txt', '.text', '.sh', '.cfg', '.conf')
self.music = ('.psf', '.mp3', '.ogg' , '.flac')
self.images = ('.png', '.jpg', '.jpeg', '.gif')
self.pdf = ('.pdf')
self.office = settings.returnOfficeFilter()
self.vids = settings.returnVidsFilter()
self.txt = settings.returnTextFilter()
self.music = settings.returnMusicFilter()
self.images = settings.returnImagesFilter()
self.pdf = settings.returnPdfFilter()
# Args
self.MEDIAPLAYER = "mpv";
self.IMGVIEWER = "mirage";
self.MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
self.OFFICEPROG = "libreoffice";
self.TEXTVIEWER = "leafpad";
self.PDFVIEWER = "evince";
self.FILEMANAGER = "spacefm";
self.MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
self.MPV_WH = " -geometry 50%:50% ";
self.MEDIAPLAYER = settings.returnMediaProg()
self.IMGVIEWER = settings.returnImgVwrProg()
self.MUSICPLAYER = settings.returnMusicProg()
self.OFFICEPROG = settings.returnOfficeProg()
self.TEXTVIEWER = settings.returnTextProg()
self.PDFVIEWER = settings.returnPdfProg()
self.FILEMANAGER = settings.returnFileMngrProg()
self.MPLAYER_WH = settings.returnMplyrWH()
self.MPV_WH = settings.returnMpvWHProg()
self.TRASHFILESFOLDER = settings.returnTrshFilesPth()
self.TRASHINFOFOLDER = settings.returnTrshInfoPth()
@threaded
def openFile(self, file):
@ -65,21 +69,39 @@ class FileHandler:
print(e)
return 1
def deleteFile(self, toDeleteFile):
def moveToTrash(arg):
try:
print("Moving to Trash...")
for file in toDeleteFiles:
print(file)
if os.path.exists(file):
shutil.move(file, self.TRASHFILESFOLDER)
else:
print("The folder/file does not exist")
return 1
except Exception as e:
print("An error occured moving the file to trash:")
print(e)
return 1
return 0
def deleteFiles(self, toDeleteFiles):
try:
print("Deleting...")
print(toDeleteFile)
if os.path.exists(toDeleteFile):
if os.path.isfile(toDeleteFile):
os.remove(toDeleteFile)
elif os.path.isdir(toDeleteFile):
shutil.rmtree(toDeleteFile)
for file in toDeleteFiles:
print(file)
if os.path.exists(file):
if os.path.isfile(file):
os.remove(file)
elif os.path.isdir(file):
shutil.rmtree(file)
else:
print("An error occured deleting the file:")
return 1
else:
print("An error occured deleting the file:")
print("The folder/file does not exist")
return 1
else:
print("The folder/file does not exist")
return 1
except Exception as e:
print("An error occured deleting the file:")
print(e)

View File

@ -15,24 +15,52 @@ import os
class Settings:
def __init__(self):
self.builder = None
# 'Filters'
self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm',
'.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf')
self.vids = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv',
'.mpeg', '.mp4', '.webm')
self.txt = ('.txt', '.text', '.sh', '.cfg', '.conf')
self.music = ('.psf', '.mp3', '.ogg' , '.flac')
self.images = ('.png', '.jpg', '.jpeg', '.gif')
self.pdf = ('.pdf')
self.hideHiddenFiles = True
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
self.THUMB_GENERATOR = "ffmpegthumbnailer"
self.DEFAULTCOLOR = gdk.RGBA(0.0, 0.0, 0.0, 0.0) # ~#00000000
self.MOUSEOVERCOLOR = gdk.RGBA(0.0, 0.9, 1.0, 0.64) # ~#00e8ff
self.SELECTEDCOLOR = gdk.RGBA(0.4, 0.5, 0.1, 0.84)
self.ColumnSize = 8
self.usrHome = os.path.expanduser('~')
self.desktopPath = self.usrHome + "/Desktop"
self.webHome = 'http://webfm.com/'
self.iconContainerWxH = [128, 128]
self.systemIconImageWxH = [72, 72]
self.viIconWxH = [256, 128]
self.vidsExtensionList = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
self.imagesExtensionList = ('.png', '.jpg', '.jpeg', '.gif', '.ico', '.tga')
self.DEFAULTCOLOR = gdk.RGBA(0.0, 0.0, 0.0, 0.0) # ~#00000000
self.MOUSEOVERCOLOR = gdk.RGBA(0.0, 0.9, 1.0, 0.64) # ~#00e8ff
self.SELECTEDCOLOR = gdk.RGBA(0.4, 0.5, 0.1, 0.84)
self.TRASHFOLDER = os.path.expanduser('~') + "/.local/share/Trash/"
self.TRASHFILESFOLDER = self.TRASHFOLDER + "files/"
self.TRASHINFOFOLDER = self.TRASHFOLDER + "info/"
self.THUMB_GENERATOR = "ffmpegthumbnailer"
self.MEDIAPLAYER = "mpv";
self.IMGVIEWER = "mirage";
self.MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
self.OFFICEPROG = "libreoffice";
self.TEXTVIEWER = "leafpad";
self.PDFVIEWER = "evince";
self.FILEMANAGER = "spacefm";
self.MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
self.MPV_WH = " -geometry 50%:50% ";
self.GTK_ORIENTATION = 1 # HORIZONTAL (0) VERTICAL (1)
if os.path.isdir(self.TRASHFOLDER) == False:
os.mkdir(TRASHFILESFOLDER)
os.mkdir(TRASHINFOFOLDER)
if os.path.isdir(self.TRASHFILESFOLDER) == False:
os.mkdir(TRASHFILESFOLDER)
if os.path.isdir(self.TRASHINFOFOLDER) == False:
os.mkdir(TRASHINFOFOLDER)
def attachBuilder(self, builder):
@ -77,68 +105,31 @@ class Settings:
def returnBuilder(self): return self.builder
def returnUserHome(self): return self.usrHome
def returnDesktopPath(self): return self.usrHome + "/Desktop"
def returnIconImagePos(self): return self.GTK_ORIENTATION
def getThumbnailGenerator(self): return self.THUMB_GENERATOR
def returnColumnSize(self): return self.ColumnSize
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 returnVidsExtensionList(self): return self.vidsExtensionList
def returnImagesExtensionList(self): return self.imagesExtensionList
def setDefaultWebviewSettings(self, widget, settings=None):
# Usability
settings.set_property('enable-fullscreen', True)
settings.set_property('print-backgrounds', True)
settings.set_property('enable-frame-flattening', False)
settings.set_property('enable-plugins', True)
settings.set_property('enable-java', False)
settings.set_property('enable-resizable-text-areas', True)
settings.set_property('zoom-text-only', False)
settings.set_property('enable-smooth-scrolling', True)
settings.set_property('enable-back-forward-navigation-gestures', False)
settings.set_property('media-playback-requires-user-gesture', False)
settings.set_property('enable-tabs-to-links', True)
settings.set_property('enable-caret-browsing', False)
# Filter returns
def returnOfficeFilter(self): return self.office
def returnVidsFilter(self): return self.vids
def returnTextFilter(self): return self.txt
def returnMusicFilter(self): return self.music
def returnImagesFilter(self): return self.images
def returnPdfFilter(self): return self.pdf
# Security
settings.set_property('user-agent','Mozilla/5.0 (X11; Generic; Linux x86-64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Safari/605.1.15')
settings.set_property('enable-private-browsing', False)
settings.set_property('enable-xss-auditor', True)
settings.set_property('enable-hyperlink-auditing', False)
settings.set_property('enable-site-specific-quirks', True)
settings.set_property('enable-offline-web-application-cache', True)
settings.set_property('enable-page-cache', True)
settings.set_property('allow-modal-dialogs', False)
settings.set_property('enable-html5-local-storage', True)
settings.set_property('enable-html5-database', True)
settings.set_property('allow-file-access-from-file-urls', False)
settings.set_property('allow-universal-access-from-file-urls', False)
settings.set_property('enable-dns-prefetching', False)
# Media stuff
# settings.set_property('hardware-acceleration-policy', 'on-demand')
settings.set_property('enable-webgl', False)
settings.set_property('enable-webaudio', True)
settings.set_property('enable-accelerated-2d-canvas', True)
settings.set_property('auto-load-images', True)
settings.set_property('enable-media-capabilities', True)
settings.set_property('enable-media-stream', True)
settings.set_property('enable-mediasource', True)
settings.set_property('enable-encrypted-media', True)
settings.set_property('media-playback-allows-inline', True)
# JS
settings.set_property('enable-javascript', True)
settings.set_property('enable-javascript-markup', True)
settings.set_property('javascript-can-access-clipboard', False)
settings.set_property('javascript-can-open-windows-automatically', False)
# Debugging
settings.set_property('enable-developer-extras', False)
settings.set_property('enable-write-console-messages-to-stdout', False)
settings.set_property('draw-compositing-indicators', False)
settings.set_property('enable-mock-capture-devices', False)
settings.set_property('enable-spatial-navigation', False)
def returnIconImagePos(self): return self.GTK_ORIENTATION
def getThumbnailGenerator(self): return self.THUMB_GENERATOR
def returnMediaProg(self): return self.MEDIAPLAYER
def returnImgVwrProg(self): return self.IMGVIEWER
def returnMusicProg(self): return self.MUSICPLAYER
def returnOfficeProg(self): return self.OFFICEPROG
def returnTextProg(self): return self.TEXTVIEWER
def returnPdfProg(self): return self.PDFVIEWER
def returnFileMngrProg(self): return self.FILEMANAGER
def returnMplyrWH(self): return self.MPLAYER_WH
def returnMpvWHProg(self): return self.MPV_WH
def returnTrshFilesPth(self): return self.TRASHFILESFOLDER
def returnTrshInfoPth(self): return self.TRASHINFOFOLDER

View File

@ -27,26 +27,26 @@ class Grid:
def __init__(self, desktop, settings):
self.desktop = desktop
self.settings = settings
self.fileHandler = FileHandler(self.settings)
self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str)
self.usrHome = settings.returnUserHome()
self.builder = settings.returnBuilder()
self.ColumnSize = settings.returnColumnSize()
self.vidsList = settings.returnVidsExtensionList()
self.imagesList = settings.returnImagesExtensionList()
self.vidsList = settings.returnVidsFilter()
self.imagesList = settings.returnImagesFilter()
self.gtkLock = False # Thread checks for gtkLock
self.threadLock = False # Gtk checks for thread lock
self.helperThread = None # Helper thread object
self.toWorkPool = [] # Thread fills pool and gtk empties it
self.copyCutArry = []
self.selectedFiles = []
self.SelectedFiles = []
self.currentPath = ""
self.desktop.set_model(self.store)
self.desktop.set_pixbuf_column(0)
self.desktop.set_text_column(1)
self.desktop.connect("item-activated", self.iconLeftClickEventManager)
self.desktop.connect("button_press_event", self.iconRightClickEventManager, (self.desktop,))
self.desktop.connect("item-activated", self.iconDblLeftClick)
self.desktop.connect("button_press_event", self.iconClickRight, (self.desktop,))
def setIconViewDir(self, path):
@ -130,7 +130,7 @@ class Grid:
time.sleep(.005) # Fixes refresh and up icon not being added.
return True
def iconLeftClickEventManager(self, widget, item):
def iconDblLeftClick(self, widget, item):
try:
model = widget.get_model()
fileName = model[item][1]
@ -147,25 +147,25 @@ class Grid:
self.currentPath = file
self.setIconViewDir(self.currentPath)
elif isfile(file):
FileHandler().openFile(file)
self.fileHandler.openFile(file)
except Exception as e:
print(e)
def iconRightClickEventManager(self, widget, eve, rclicked_icon):
def iconClickRight(self, widget, eve, rclicked_icon):
try:
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
input = self.builder.get_object("iconRenameInput")
controls = self.builder.get_object("iconControlsWindow")
items = widget.get_selected_items()
model = widget.get_model()
self.selectedFiles = []
self.SelectedFiles.clear()
if len(items) == 1:
fileName = model[items[0]][1]
dir = self.currentPath
file = dir + "/" + fileName
self.selectedFiles.append(file) # Used for return to caller
self.SelectedFiles.append(file) # Used for return to caller
input.set_text(fileName)
controls.show_all()
elif len(items) > 1:
@ -173,8 +173,7 @@ class Grid:
for item in items:
fileName = model[item][1]
file = dir + "/" + fileName
self.selectedFiles.append(file) # Used for return to caller
print(file)
self.SelectedFiles.append(file) # Used for return to caller
input.set_text("")
input.hide()
@ -182,3 +181,9 @@ class Grid:
except Exception as e:
print(e)
def returnSelectedFiles(self):
return self.SelectedFiles
def returnCurrentPath(self):
return self.currentPath

View File

@ -24,8 +24,8 @@ class Icon:
def __init__(self, settings):
self.settings = settings
self.thubnailGen = settings.getThumbnailGenerator()
self.vidsList = settings.returnVidsExtensionList()
self.imagesList = settings.returnImagesExtensionList()
self.vidsList = settings.returnVidsFilter()
self.imagesList = settings.returnImagesFilter()
self.GTK_ORIENTATION = settings.returnIconImagePos()
self.usrHome = settings.returnUserHome()
self.iconContainerWH = settings.returnContainerWH()