Integrating controls
This commit is contained in:
parent
701c91ecd5
commit
55d2bc9cd1
@ -3,11 +3,9 @@
|
|||||||
# Gtk imports
|
# Gtk imports
|
||||||
import gi, faulthandler, signal
|
import gi, faulthandler, signal
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('WebKit2', '4.0')
|
|
||||||
|
|
||||||
from gi.repository import Gtk as gtk
|
from gi.repository import Gtk as gtk
|
||||||
from gi.repository import Gdk as gdk
|
from gi.repository import Gdk as gdk
|
||||||
from gi.repository import WebKit2 as webkit
|
|
||||||
from gi.repository import GLib
|
from gi.repository import GLib
|
||||||
|
|
||||||
# Python imports
|
# Python imports
|
||||||
@ -15,14 +13,13 @@ import inspect
|
|||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
from utils import Settings
|
from utils import Settings
|
||||||
from signal_classes import CrossClassSignals, WebviewSignals, GridSignals
|
from signal_classes import CrossClassSignals, GridSignals
|
||||||
|
|
||||||
|
|
||||||
class Main:
|
class Main:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
|
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
|
||||||
faulthandler.enable() # For better debug info
|
faulthandler.enable() # For better debug info
|
||||||
webkit.WebView() # Need one initialized for webview to work from glade file
|
|
||||||
|
|
||||||
builder = gtk.Builder()
|
builder = gtk.Builder()
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
@ -31,7 +28,6 @@ class Main:
|
|||||||
# Gets the methods from the classes and sets to handler.
|
# Gets the methods from the classes and sets to handler.
|
||||||
# Then, builder connects to any signals it needs.
|
# Then, builder connects to any signals it needs.
|
||||||
classes = [CrossClassSignals(settings),
|
classes = [CrossClassSignals(settings),
|
||||||
WebviewSignals(settings),
|
|
||||||
GridSignals(settings)]
|
GridSignals(settings)]
|
||||||
|
|
||||||
handlers = {}
|
handlers = {}
|
||||||
|
@ -2,123 +2,11 @@
|
|||||||
<!-- Generated with glade 3.22.1 -->
|
<!-- Generated with glade 3.22.1 -->
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<requires lib="gtk+" version="3.20"/>
|
||||||
<requires lib="webkit2gtk" version="2.12"/>
|
|
||||||
<object class="GtkFileFilter" id="Folders">
|
<object class="GtkFileFilter" id="Folders">
|
||||||
<mime-types>
|
<mime-types>
|
||||||
<mime-type>inode/directory</mime-type>
|
<mime-type>inode/directory</mime-type>
|
||||||
</mime-types>
|
</mime-types>
|
||||||
</object>
|
</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">
|
<object class="GtkWindow" id="Window">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="default_width">800</property>
|
<property name="default_width">800</property>
|
||||||
@ -140,21 +28,9 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="popOutBttn">
|
<placeholder/>
|
||||||
<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>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child type="center">
|
||||||
<object class="GtkFileChooserButton" id="selectedDirDialog">
|
<object class="GtkFileChooserButton" id="selectedDirDialog">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@ -169,38 +45,6 @@
|
|||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -238,30 +82,48 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkPopover" id="webViewer">
|
<object class="GtkWindow" id="iconControlsWindow">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="hexpand">True</property>
|
<property name="resizable">False</property>
|
||||||
<property name="vexpand">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="relative_to">popOutBttn</property>
|
<property name="decorated">False</property>
|
||||||
<property name="position">bottom</property>
|
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="orientation">vertical</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>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">gtk-home</property>
|
<property name="label">gtk-copy</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
<signal name="clicked" handler="loadHome" swapped="no"/>
|
<signal name="clicked" handler="copy" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -271,13 +133,13 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkButton">
|
||||||
<property name="label">gtk-refresh</property>
|
<property name="label">gtk-cut</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="always_show_image">True</property>
|
<property name="always_show_image">True</property>
|
||||||
<signal name="clicked" handler="refreshPage" swapped="no"/>
|
<signal name="clicked" handler="cut" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -286,34 +148,38 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSearchEntry" id="webviewSearch">
|
<object class="GtkButton">
|
||||||
|
<property name="label">gtk-paste</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="primary_icon_name">edit-find-symbolic</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="primary_icon_activatable">False</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="primary_icon_sensitive">False</property>
|
<property name="always_show_image">True</property>
|
||||||
<signal name="key-release-event" handler="runSearchWebview" swapped="no"/>
|
<signal name="clicked" handler="paste" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
<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>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -10,16 +10,19 @@ from utils import FileHandler
|
|||||||
|
|
||||||
class GridSignals:
|
class GridSignals:
|
||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
self.filehandler = FileHandler()
|
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
self.filehandler = FileHandler(settings)
|
||||||
|
|
||||||
self.builder = self.settings.returnBuilder()
|
self.builder = self.settings.returnBuilder()
|
||||||
self.desktop = self.builder.get_object("Desktop")
|
self.desktop = self.builder.get_object("Desktop")
|
||||||
selectedDirDialog = self.builder.get_object("selectedDirDialog")
|
selectedDirDialog = self.builder.get_object("selectedDirDialog")
|
||||||
filefilter = self.builder.get_object("Folders")
|
filefilter = self.builder.get_object("Folders")
|
||||||
|
|
||||||
self.desktopPath = self.settings.returnDesktopPath()
|
self.desktopPath = self.settings.returnDesktopPath()
|
||||||
self.grid = None
|
self.copyCutArry = []
|
||||||
|
self.selectedFiles = []
|
||||||
|
self.grid = None
|
||||||
|
self.currentPath = ""
|
||||||
|
|
||||||
# Add filter to allow only folders to be selected
|
# Add filter to allow only folders to be selected
|
||||||
selectedDirDialog.add_filter(filefilter)
|
selectedDirDialog.add_filter(filefilter)
|
||||||
@ -27,6 +30,7 @@ class GridSignals:
|
|||||||
|
|
||||||
self.setIconViewDir(selectedDirDialog)
|
self.setIconViewDir(selectedDirDialog)
|
||||||
|
|
||||||
|
|
||||||
def setIconViewDir(self, widget, data=None):
|
def setIconViewDir(self, widget, data=None):
|
||||||
newPath = widget.get_filename()
|
newPath = widget.get_filename()
|
||||||
self.grid = Grid(self.desktop, self.settings)
|
self.grid = Grid(self.desktop, self.settings)
|
||||||
@ -37,32 +41,38 @@ class GridSignals:
|
|||||||
def createFile(arg):
|
def createFile(arg):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def updateFile(self, file):
|
def updateFile(self, widget, data):
|
||||||
if len(self.selectedFiles) == 1:
|
if data.keyval == 65293: # Enter key press
|
||||||
newName = self.currentPath + "/" + file
|
self.getGridInfo()
|
||||||
status = self.filehandler.updateFile(self.selectedFiles[0], newName)
|
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:
|
if status == 0:
|
||||||
self.selectedFiles = [newName]
|
self.selectedFiles = [newName]
|
||||||
self.setIconViewDir(self.currentPath)
|
self.grid.setIconViewDir(self.currentPath)
|
||||||
|
|
||||||
|
|
||||||
def deleteFiles(self):
|
def deleteFiles(self, widget):
|
||||||
if len(self.selectedFiles) == 1:
|
self.getGridInfo()
|
||||||
status = self.filehandler.deleteFile(self.selectedFiles[0])
|
status = self.filehandler.deleteFiles(self.selectedFiles)
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
self.selectedFiles = []
|
self.selectedFiles = []
|
||||||
self.setIconViewDir(self.currentPath)
|
self.grid.setIconViewDir(self.currentPath)
|
||||||
elif len(self.selectedFiles) > 1:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
def copy(self):
|
||||||
|
self.copyCutArry = self.grid.returnSelectedFiles()
|
||||||
|
|
||||||
def copyFile(self):
|
def cut(self):
|
||||||
pass
|
self.copyCutArry = self.grid.returnSelectedFiles()
|
||||||
|
|
||||||
def cutFile(self):
|
def paste(self):
|
||||||
pass
|
self.currentPath = self.grid.returnCurrentPath()
|
||||||
|
|
||||||
def pasteFile(self):
|
def getGridInfo(self):
|
||||||
pass
|
self.selectedFiles = self.grid.returnSelectedFiles()
|
||||||
|
self.currentPath = self.grid.returnCurrentPath()
|
||||||
|
@ -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())
|
|
@ -1,3 +1,2 @@
|
|||||||
from signal_classes.CrossClassSignals import CrossClassSignals
|
from signal_classes.CrossClassSignals import CrossClassSignals
|
||||||
from signal_classes.WebviewSignals import WebviewSignals
|
|
||||||
from signal_classes.GridSignals import GridSignals
|
from signal_classes.GridSignals import GridSignals
|
||||||
|
@ -12,25 +12,29 @@ def threaded(fn):
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
class FileHandler:
|
class FileHandler:
|
||||||
def __init__(self):
|
def __init__(self, settings):
|
||||||
# 'Filters'
|
# 'Filters'
|
||||||
self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx' '.xlm', '.ppt', 'pptx', '.pps', '.ppsx', '.odt', '.rtf')
|
self.office = settings.returnOfficeFilter()
|
||||||
self.vids = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
|
self.vids = settings.returnVidsFilter()
|
||||||
self.txt = ('.txt', '.text', '.sh', '.cfg', '.conf')
|
self.txt = settings.returnTextFilter()
|
||||||
self.music = ('.psf', '.mp3', '.ogg' , '.flac')
|
self.music = settings.returnMusicFilter()
|
||||||
self.images = ('.png', '.jpg', '.jpeg', '.gif')
|
self.images = settings.returnImagesFilter()
|
||||||
self.pdf = ('.pdf')
|
self.pdf = settings.returnPdfFilter()
|
||||||
|
|
||||||
# Args
|
# Args
|
||||||
self.MEDIAPLAYER = "mpv";
|
self.MEDIAPLAYER = settings.returnMediaProg()
|
||||||
self.IMGVIEWER = "mirage";
|
self.IMGVIEWER = settings.returnImgVwrProg()
|
||||||
self.MUSICPLAYER = "/opt/deadbeef/bin/deadbeef";
|
self.MUSICPLAYER = settings.returnMusicProg()
|
||||||
self.OFFICEPROG = "libreoffice";
|
self.OFFICEPROG = settings.returnOfficeProg()
|
||||||
self.TEXTVIEWER = "leafpad";
|
self.TEXTVIEWER = settings.returnTextProg()
|
||||||
self.PDFVIEWER = "evince";
|
self.PDFVIEWER = settings.returnPdfProg()
|
||||||
self.FILEMANAGER = "spacefm";
|
self.FILEMANAGER = settings.returnFileMngrProg()
|
||||||
self.MPLAYER_WH = " -xy 1600 -geometry 50%:50% ";
|
self.MPLAYER_WH = settings.returnMplyrWH()
|
||||||
self.MPV_WH = " -geometry 50%:50% ";
|
self.MPV_WH = settings.returnMpvWHProg()
|
||||||
|
self.TRASHFILESFOLDER = settings.returnTrshFilesPth()
|
||||||
|
self.TRASHINFOFOLDER = settings.returnTrshInfoPth()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def openFile(self, file):
|
def openFile(self, file):
|
||||||
@ -65,21 +69,39 @@ class FileHandler:
|
|||||||
print(e)
|
print(e)
|
||||||
return 1
|
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:
|
try:
|
||||||
print("Deleting...")
|
print("Deleting...")
|
||||||
print(toDeleteFile)
|
for file in toDeleteFiles:
|
||||||
if os.path.exists(toDeleteFile):
|
print(file)
|
||||||
if os.path.isfile(toDeleteFile):
|
if os.path.exists(file):
|
||||||
os.remove(toDeleteFile)
|
if os.path.isfile(file):
|
||||||
elif os.path.isdir(toDeleteFile):
|
os.remove(file)
|
||||||
shutil.rmtree(toDeleteFile)
|
elif os.path.isdir(file):
|
||||||
|
shutil.rmtree(file)
|
||||||
|
else:
|
||||||
|
print("An error occured deleting the file:")
|
||||||
|
return 1
|
||||||
else:
|
else:
|
||||||
print("An error occured deleting the file:")
|
print("The folder/file does not exist")
|
||||||
return 1
|
return 1
|
||||||
else:
|
|
||||||
print("The folder/file does not exist")
|
|
||||||
return 1
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("An error occured deleting the file:")
|
print("An error occured deleting the file:")
|
||||||
print(e)
|
print(e)
|
||||||
|
@ -15,24 +15,52 @@ import os
|
|||||||
class Settings:
|
class Settings:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.builder = None
|
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.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.ColumnSize = 8
|
||||||
self.usrHome = os.path.expanduser('~')
|
self.usrHome = os.path.expanduser('~')
|
||||||
self.desktopPath = self.usrHome + "/Desktop"
|
self.desktopPath = self.usrHome + "/Desktop"
|
||||||
self.webHome = 'http://webfm.com/'
|
|
||||||
self.iconContainerWxH = [128, 128]
|
self.iconContainerWxH = [128, 128]
|
||||||
self.systemIconImageWxH = [72, 72]
|
self.systemIconImageWxH = [72, 72]
|
||||||
self.viIconWxH = [256, 128]
|
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):
|
def attachBuilder(self, builder):
|
||||||
@ -77,68 +105,31 @@ class Settings:
|
|||||||
def returnBuilder(self): return self.builder
|
def returnBuilder(self): return self.builder
|
||||||
def returnUserHome(self): return self.usrHome
|
def returnUserHome(self): return self.usrHome
|
||||||
def returnDesktopPath(self): return self.usrHome + "/Desktop"
|
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 returnColumnSize(self): return self.ColumnSize
|
||||||
def returnContainerWH(self): return self.iconContainerWxH
|
def returnContainerWH(self): return self.iconContainerWxH
|
||||||
def returnSystemIconImageWH(self): return self.systemIconImageWxH
|
def returnSystemIconImageWH(self): return self.systemIconImageWxH
|
||||||
def returnVIIconWH(self): return self.viIconWxH
|
def returnVIIconWH(self): return self.viIconWxH
|
||||||
def returnWebHome(self): return self.webHome
|
|
||||||
def isHideHiddenFiles(self): return self.hideHiddenFiles
|
def isHideHiddenFiles(self): return self.hideHiddenFiles
|
||||||
def returnVidsExtensionList(self): return self.vidsExtensionList
|
|
||||||
def returnImagesExtensionList(self): return self.imagesExtensionList
|
def returnImagesExtensionList(self): return self.imagesExtensionList
|
||||||
|
|
||||||
def setDefaultWebviewSettings(self, widget, settings=None):
|
# Filter returns
|
||||||
# Usability
|
def returnOfficeFilter(self): return self.office
|
||||||
settings.set_property('enable-fullscreen', True)
|
def returnVidsFilter(self): return self.vids
|
||||||
settings.set_property('print-backgrounds', True)
|
def returnTextFilter(self): return self.txt
|
||||||
settings.set_property('enable-frame-flattening', False)
|
def returnMusicFilter(self): return self.music
|
||||||
settings.set_property('enable-plugins', True)
|
def returnImagesFilter(self): return self.images
|
||||||
settings.set_property('enable-java', False)
|
def returnPdfFilter(self): return self.pdf
|
||||||
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)
|
|
||||||
|
|
||||||
# Security
|
def returnIconImagePos(self): return self.GTK_ORIENTATION
|
||||||
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')
|
def getThumbnailGenerator(self): return self.THUMB_GENERATOR
|
||||||
settings.set_property('enable-private-browsing', False)
|
def returnMediaProg(self): return self.MEDIAPLAYER
|
||||||
settings.set_property('enable-xss-auditor', True)
|
def returnImgVwrProg(self): return self.IMGVIEWER
|
||||||
settings.set_property('enable-hyperlink-auditing', False)
|
def returnMusicProg(self): return self.MUSICPLAYER
|
||||||
settings.set_property('enable-site-specific-quirks', True)
|
def returnOfficeProg(self): return self.OFFICEPROG
|
||||||
settings.set_property('enable-offline-web-application-cache', True)
|
def returnTextProg(self): return self.TEXTVIEWER
|
||||||
settings.set_property('enable-page-cache', True)
|
def returnPdfProg(self): return self.PDFVIEWER
|
||||||
settings.set_property('allow-modal-dialogs', False)
|
def returnFileMngrProg(self): return self.FILEMANAGER
|
||||||
settings.set_property('enable-html5-local-storage', True)
|
def returnMplyrWH(self): return self.MPLAYER_WH
|
||||||
settings.set_property('enable-html5-database', True)
|
def returnMpvWHProg(self): return self.MPV_WH
|
||||||
settings.set_property('allow-file-access-from-file-urls', False)
|
def returnTrshFilesPth(self): return self.TRASHFILESFOLDER
|
||||||
settings.set_property('allow-universal-access-from-file-urls', False)
|
def returnTrshInfoPth(self): return self.TRASHINFOFOLDER
|
||||||
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)
|
|
||||||
|
@ -27,26 +27,26 @@ class Grid:
|
|||||||
def __init__(self, desktop, settings):
|
def __init__(self, desktop, settings):
|
||||||
self.desktop = desktop
|
self.desktop = desktop
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
|
self.fileHandler = FileHandler(self.settings)
|
||||||
|
|
||||||
self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str)
|
self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str)
|
||||||
self.usrHome = settings.returnUserHome()
|
self.usrHome = settings.returnUserHome()
|
||||||
self.builder = settings.returnBuilder()
|
self.builder = settings.returnBuilder()
|
||||||
self.ColumnSize = settings.returnColumnSize()
|
self.ColumnSize = settings.returnColumnSize()
|
||||||
self.vidsList = settings.returnVidsExtensionList()
|
self.vidsList = settings.returnVidsFilter()
|
||||||
self.imagesList = settings.returnImagesExtensionList()
|
self.imagesList = settings.returnImagesFilter()
|
||||||
self.gtkLock = False # Thread checks for gtkLock
|
self.gtkLock = False # Thread checks for gtkLock
|
||||||
self.threadLock = False # Gtk checks for thread lock
|
self.threadLock = False # Gtk checks for thread lock
|
||||||
self.helperThread = None # Helper thread object
|
self.helperThread = None # Helper thread object
|
||||||
self.toWorkPool = [] # Thread fills pool and gtk empties it
|
self.toWorkPool = [] # Thread fills pool and gtk empties it
|
||||||
self.copyCutArry = []
|
self.SelectedFiles = []
|
||||||
self.selectedFiles = []
|
|
||||||
self.currentPath = ""
|
self.currentPath = ""
|
||||||
|
|
||||||
self.desktop.set_model(self.store)
|
self.desktop.set_model(self.store)
|
||||||
self.desktop.set_pixbuf_column(0)
|
self.desktop.set_pixbuf_column(0)
|
||||||
self.desktop.set_text_column(1)
|
self.desktop.set_text_column(1)
|
||||||
self.desktop.connect("item-activated", self.iconLeftClickEventManager)
|
self.desktop.connect("item-activated", self.iconDblLeftClick)
|
||||||
self.desktop.connect("button_press_event", self.iconRightClickEventManager, (self.desktop,))
|
self.desktop.connect("button_press_event", self.iconClickRight, (self.desktop,))
|
||||||
|
|
||||||
|
|
||||||
def setIconViewDir(self, path):
|
def setIconViewDir(self, path):
|
||||||
@ -130,7 +130,7 @@ class Grid:
|
|||||||
time.sleep(.005) # Fixes refresh and up icon not being added.
|
time.sleep(.005) # Fixes refresh and up icon not being added.
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def iconLeftClickEventManager(self, widget, item):
|
def iconDblLeftClick(self, widget, item):
|
||||||
try:
|
try:
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
fileName = model[item][1]
|
fileName = model[item][1]
|
||||||
@ -147,25 +147,25 @@ class Grid:
|
|||||||
self.currentPath = file
|
self.currentPath = file
|
||||||
self.setIconViewDir(self.currentPath)
|
self.setIconViewDir(self.currentPath)
|
||||||
elif isfile(file):
|
elif isfile(file):
|
||||||
FileHandler().openFile(file)
|
self.fileHandler.openFile(file)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
def iconRightClickEventManager(self, widget, eve, rclicked_icon):
|
def iconClickRight(self, widget, eve, rclicked_icon):
|
||||||
try:
|
try:
|
||||||
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
|
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
|
||||||
input = self.builder.get_object("iconRenameInput")
|
input = self.builder.get_object("iconRenameInput")
|
||||||
controls = self.builder.get_object("iconControlsWindow")
|
controls = self.builder.get_object("iconControlsWindow")
|
||||||
items = widget.get_selected_items()
|
items = widget.get_selected_items()
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
self.selectedFiles = []
|
self.SelectedFiles.clear()
|
||||||
|
|
||||||
if len(items) == 1:
|
if len(items) == 1:
|
||||||
fileName = model[items[0]][1]
|
fileName = model[items[0]][1]
|
||||||
dir = self.currentPath
|
dir = self.currentPath
|
||||||
file = dir + "/" + fileName
|
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)
|
input.set_text(fileName)
|
||||||
controls.show_all()
|
controls.show_all()
|
||||||
elif len(items) > 1:
|
elif len(items) > 1:
|
||||||
@ -173,8 +173,7 @@ class Grid:
|
|||||||
for item in items:
|
for item in items:
|
||||||
fileName = model[item][1]
|
fileName = model[item][1]
|
||||||
file = dir + "/" + fileName
|
file = dir + "/" + fileName
|
||||||
self.selectedFiles.append(file) # Used for return to caller
|
self.SelectedFiles.append(file) # Used for return to caller
|
||||||
print(file)
|
|
||||||
|
|
||||||
input.set_text("")
|
input.set_text("")
|
||||||
input.hide()
|
input.hide()
|
||||||
@ -182,3 +181,9 @@ class Grid:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
def returnSelectedFiles(self):
|
||||||
|
return self.SelectedFiles
|
||||||
|
|
||||||
|
def returnCurrentPath(self):
|
||||||
|
return self.currentPath
|
||||||
|
@ -24,8 +24,8 @@ class Icon:
|
|||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
self.thubnailGen = settings.getThumbnailGenerator()
|
self.thubnailGen = settings.getThumbnailGenerator()
|
||||||
self.vidsList = settings.returnVidsExtensionList()
|
self.vidsList = settings.returnVidsFilter()
|
||||||
self.imagesList = settings.returnImagesExtensionList()
|
self.imagesList = settings.returnImagesFilter()
|
||||||
self.GTK_ORIENTATION = settings.returnIconImagePos()
|
self.GTK_ORIENTATION = settings.returnIconImagePos()
|
||||||
self.usrHome = settings.returnUserHome()
|
self.usrHome = settings.returnUserHome()
|
||||||
self.iconContainerWH = settings.returnContainerWH()
|
self.iconContainerWH = settings.returnContainerWH()
|
||||||
|
Loading…
Reference in New Issue
Block a user