Changed structural stuff

This commit is contained in:
Maxim Stewart 2019-06-22 19:21:18 -05:00
parent 4ce44d9add
commit 12130786fe
55 changed files with 38 additions and 1300 deletions

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Fixes ownershp
function main() {
sudo find . -type f -exec chmod 644 {} +
sudo find . -type d -exec chmod 755 {} +
# Set postrm permissions
for i in `find . -name postrm`; do
sudo chmod 755 "${i}"
done
# Set pytop permissions
for i in `find . -name pytop`; do
sudo chmod 755 "${i}"
done
sudo chown -R root:root ./*/
builder;
bash ./chownAll.sh
}
#builds debs
function builder() {
for i in `ls`; do
if [[ -d "${i}" ]]; then
dpkg --build "${i}"
else
echo "Not a dir."
fi
done
}
main;

View File

@ -1,6 +0,0 @@
#!/bin/bash
function main() {
sudo chown -R abaddon:abaddon .
}
main;

View File

@ -1,8 +0,0 @@
Package: pytop64
Version: 0.0-1
Section: python
Priority: optional
Architecture: amd64
Depends: ffmpegthumbnailer (>= 2.0.10-0.1)
Maintainer: Maxim Stewart <1itdominator@gmail.com>
Description: Pytop is a custom desktop GUI.

View File

@ -1,11 +0,0 @@
#!/bin/bash
#postrm (script executed after uninstalling the package)
#set -e
if [ -f /bin/pytop ]; then
rm /bin/pytop
fi
if [ -d /opt/Pytop ]; then
rm -rf /opt/Pytop
fi

Binary file not shown.

View File

@ -1,72 +0,0 @@
# Gtk Imports
# Python imports
from .Grid import Grid
from .Dragging import Dragging
class Events:
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.settings.setDefaultWebviewSettings(self.webview, self.webview.get_settings())
self.webview.load_uri(self.settings.returnWebHome())
# 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)
self.grid = None
self.setIconViewDir(selectedDirDialog)
def setIconViewDir(self, widget, data=None):
newPath = widget.get_filename()
Grid(self.desktop, self.settings, newPath)
# File control events
def createFile(self):
pass
def updateFile(self, widget, data=None):
newName = widget.get_text().strip()
if data and data.keyval == 65293: # Enter key event
self.grid.updateFile(newName)
elif data == None: # Save button 'event'
self.grid.updateFile(newName)
def deleteFile(self, widget, data=None):
self.grid.deleteFile()
def copyFile(self):
pass
def cutFile(self):
pass
def pasteFile(self):
pass
# Webview events
def showWebview(self, widget):
self.builder.get_object("webViewer").popup()
def loadHome(self, widget):
self.webview.load_uri(self.settings.returnWebHome())
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.builder.get_object("webviewSearch").set_text(widget.get_uri())

View File

@ -1,214 +0,0 @@
# Gtk Imports
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
from gi.repository import GLib as glib
from gi.repository import GdkPixbuf
# Python imports
import os, threading, time
from os.path import isdir, isfile, join
from os import listdir
from .Icon import Icon
from .FileHandler import FileHandler
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
class Grid:
def __init__(self, desktop, settings, newPath):
self.desktop = desktop
self.settings = settings
self.filehandler = FileHandler()
self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str)
self.usrHome = settings.returnUserHome()
self.builder = settings.returnBuilder()
self.ColumnSize = settings.returnColumnSize()
self.currentPath = ""
self.selectedFile = ""
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("selection-changed", self.setIconSelectionArray, (self.desktop,))
self.vidsList = settings.returnVidsExtensionList()
self.imagesList = settings.returnImagesExtensionList()
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.setIconViewDir(newPath)
def setIconViewDir(self, path):
self.store.clear()
self.currentPath = path
dirPaths = ['.', '..']
vids = []
images = []
desktop = []
files = []
for f in listdir(path):
file = join(path, f)
if self.settings.isHideHiddenFiles():
if f.startswith('.'):
continue
if isfile(file):
if file.lower().endswith(self.vidsList):
vids.append(f)
elif file.lower().endswith(self.imagesList):
images.append(f)
elif file.lower().endswith((".desktop",)):
desktop.append(f)
else:
files.append(f)
else:
dirPaths.append(f)
dirPaths.sort()
vids.sort()
images.sort()
desktop.sort()
files.sort()
files = dirPaths + vids + images + desktop + files
if self.helperThread:
self.helperThread.terminate()
self.helperThread = None
# Run helper thread...
self.threadLock = True
self.helperThread = threading.Thread(target=self.generateDirectoryGridIcon, args=(path, files)).start()
glib.idle_add(self.addToGrid, (file,)) # This must stay in the main thread b/c
# gtk isn't thread safe/aware So, we
# make a sad lil thread hot potato 'game'
# out of this process.
# @threaded
def generateDirectoryGridIcon(self, dirPath, files):
# NOTE: We'll be passing pixbuf after retreval to keep Icon.py file more
# universaly usable. We can just remove get_pixbuf to get a gtk.Image type
for file in files:
image = Icon(self.settings).createIcon(dirPath, file)
self.toWorkPool.append([image.get_pixbuf(), file])
self.threadLock = False
self.gtkLock = True
def addToGrid(self, args):
# NOTE: Returning true tells gtk to check again in the future when idle.
# False ends checks and "continues normal flow"
files = args[0]
if len(self.toWorkPool) > 0:
for dataSet in self.toWorkPool:
self.store.append(dataSet)
if len(self.store) == len(files): # Confirm processed all files and cleanup
self.gtkLock = False
self.threadLock = False
self.toWorkPool.clear()
return False
# Check again when idle; If nothing else is updating, this function
# gets called immediatly. So, we play hot potato by passing lock to Thread
else:
self.toWorkPool.clear()
self.gtkLock = False
self.threadLock = True
time.sleep(.005) # Fixes refresh and up icon not being added.
return True
def setIconSelectionArray(self, widget, data=None):
pass
# os.system('cls||clear')
# print(data)
def iconLeftClickEventManager(self, widget, item):
try:
model = widget.get_model()
fileName = model[item][1]
dir = self.currentPath
file = dir + "/" + fileName
if fileName == ".":
self.setIconViewDir(dir)
elif fileName == "..":
parentDir = os.path.abspath(os.path.join(dir, os.pardir))
self.currentPath = parentDir
self.setIconViewDir(parentDir)
elif isdir(file):
self.currentPath = file
self.setIconViewDir(self.currentPath)
elif isfile(file):
self.filehandler.openFile(file)
except Exception as e:
print(e)
def iconRightClickEventManager(self, widget, eve, params):
try:
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
popover = self.builder.get_object("iconControlsWindow")
popover.show_all()
popover.popup()
# # NOTE: Need to change name of listview box...
# children = widget.get_children()[0].get_children()
# fileName = children[1].get_text()
# dir = self.currentPath
# file = dir + "/" + fileName
#
# input = self.builder.get_object("iconRenameInput")
# popover = self.builder.get_object("iconControlsWindow")
# self.selectedFile = file # Used for return to caller
#
# input.set_text(fileName)
# popover.set_relative_to(widget)
# popover.set_position(gtk.PositionType.RIGHT)
# popover.show_all()
# popover.popup()
except Exception as e:
print(e)
# Passthrough file control events
def createFile(arg):
pass
def updateFile(self, file):
newName = self.currentPath + "/" + file
status = self.filehandler.updateFile(self.selectedFile, newName)
if status == 0:
self.selectedFile = newName
self.setIconViewDir(self.currentPath)
def deleteFile(self):
status = self.filehandler.deleteFile(self.selectedFile)
if status == 0:
self.selectedFile = ""
self.setIconViewDir(self.currentPath)
def copyFile(self):
pass
def cutFile(self):
pass
def pasteFile(self):
pass

View File

@ -1,22 +0,0 @@
Pytop is copyright 2019 Maxim Stewart.
Pytop is currently developed by ITDominator <1itdominator@gmail.com>.
License: GPLv2+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
See /usr/share/common-licenses/GPL-2, or
<http://www.gnu.org/copyleft/gpl.txt> for the terms of the latest version
of the GNU General Public License.

View File

@ -2,8 +2,9 @@
# Gtk Imports # Gtk Imports
# Python imports # Python imports
from .Grid import Grid from widgets import Grid
from .Dragging import Dragging from utils import Dragging
class Events: class Events:
def __init__(self, settings): def __init__(self, settings):
@ -30,6 +31,19 @@ class Events:
Grid(self.desktop, self.settings, newPath) Grid(self.desktop, self.settings, newPath)
def getWindowsOnScreen(self):
screen = self.settings.returnScren()
windowButtons = self.builder.get_object("windowButtons")
# File control events # File control events
def createFile(self): def createFile(self):

View File

@ -1,16 +1,18 @@
#!/usr/bin/python3 #!/usr/bin/python3
# Gtk Imports # Gtk Imports
import gi, faulthandler import gi, faulthandler, signal
gi.require_version('Gtk', '3.0') gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.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 WebKit2 as webkit
from gi.repository import GLib
# Python imports # Python imports
from utils import Settings, Events from utils import Settings
from Events import Events
gdk.threads_init() gdk.threads_init()
class Main: class Main:
@ -21,6 +23,7 @@ class Main:
self.builder = gtk.Builder() self.builder = gtk.Builder()
self.settings = Settings() self.settings = Settings()
self.settings.attachBuilder(self.builder) self.settings.attachBuilder(self.builder)
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
self.builder.connect_signals(Events(self.settings)) self.builder.connect_signals(Events(self.settings))
window = self.settings.createWindow() window = self.settings.createWindow()

View File

View File

@ -113,6 +113,20 @@
<property name="position">1</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="windowButtons">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object> </object>
</child> </child>
</object> </object>

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 858 B

View File

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 850 B

View File

Before

Width:  |  Height:  |  Size: 702 B

After

Width:  |  Height:  |  Size: 702 B

View File

Before

Width:  |  Height:  |  Size: 925 B

After

Width:  |  Height:  |  Size: 925 B

View File

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 882 B

View File

Before

Width:  |  Height:  |  Size: 707 B

After

Width:  |  Height:  |  Size: 707 B

View File

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 798 B

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,6 +1,3 @@
from utils.Dragging import Dragging from utils.Dragging import Dragging
from utils.Settings import Settings from utils.Settings import Settings
from utils.Events import Events
from utils.Grid import Grid
from utils.Icon import Icon
from utils.FileHandler import FileHandler from utils.FileHandler import FileHandler

View File

@ -15,7 +15,7 @@ import os, threading, time
from os.path import isdir, isfile, join from os.path import isdir, isfile, join
from os import listdir from os import listdir
from .Icon import Icon from .Icon import Icon
from .FileHandler import FileHandler from utils.FileHandler import FileHandler
def threaded(fn): def threaded(fn):

View File

@ -0,0 +1,2 @@
from widgets.Grid import Grid
from widgets.Icon import Icon

View File

@ -1,36 +0,0 @@
#!/usr/bin/python3
# Gtk Imports
import gi, faulthandler
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
# Python imports
from utils import Settings, Events
gdk.threads_init()
class Main:
def __init__(self):
faulthandler.enable()
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.settings))
window = self.settings.createWindow()
window.fullscreen()
window.show_all()
if __name__ == "__main__":
try:
main = Main()
gtk.main()
except Exception as e:
print(e)

View File

@ -1,12 +0,0 @@
#!/bin/bash
# set -o xtrace ## To debug scripts
# set -o errexit ## To exit on error
# set -o errunset ## To exit if a variable is referenced but not set
function main() {
# GTK_DEBUG=interactive python3 ./PyTop.py
python3 ./PyTop.py
}
main $@;

View File

@ -1,305 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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="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>
<property name="default_height">600</property>
<property name="type_hint">desktop</property>
<property name="decorated">False</property>
<property name="gravity">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="width_request">256</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<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>
</child>
<child>
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="filter">Folders</property>
<property name="title" translatable="yes">Directory Chooser</property>
<signal name="file-set" handler="setIconViewDir" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<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>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkIconView" id="Desktop">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">6</property>
<property name="selection_mode">multiple</property>
<property name="columns">6</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkPopover" id="iconControlsWindow">
<property name="can_focus">False</property>
<property name="relative_to">popOutBttn</property>
<property name="position">bottom</property>
<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="GtkPopover" id="webViewer">
<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>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<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="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"/>
</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-refresh</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"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="webviewSearch">
<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"/>
</object>
<packing>
<property name="expand">True</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/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 850 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 702 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 707 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,88 +0,0 @@
viewport,
treeview,
treeview > header,
notebook > stack,
notebook > header {
background-color: rgba(0, 0, 0, 0.24);
}
notebook > header {
background-color: rgba(0, 0, 0, 0.24);
border-color: rgba(0, 232, 255, 0.64);
}
box,
iconview {
background-color: rgba(0, 0, 0, 0.2);
background: rgba(0, 0, 0, 0.2);
}
treeview,
treeview.view {
background: rgba(0, 0, 0, 0.2);
background-color: rgba(0, 0, 0, 0.2);
}
cell {
margin: 0em;
padding: 0em;
/* float: left; */
}
cell:focus {
outline-style: solid;
outline-color: rgba(0, 232, 255, 0.64);
}
/* Ivonview and children default color */
.view {
background-color: rgba(0, 0, 0, 0.22);
color: #ebebeb;
}
/* Hover over color when not selected */
.view:hover {
box-shadow: inset 0 0 0 9999px alpha(rgba(0, 232, 255, 0.64), 0.54);
}
/* Handles the icon selection hover and selected hover color. */
.view:selected,
.view:selected:hover {
box-shadow: inset 0 0 0 9999px rgba(15, 134, 13, 0.49);
}
/* Rubberband coloring */
.rubberband,
rubberband,
flowbox rubberband,
treeview.view rubberband,
.content-view rubberband,
.content-view .rubberband,
XfdesktopIconView.view .rubberband {
border: 1px solid #6c6c6c;
background-color: rgba(21, 158, 167, 0.57);
}
XfdesktopIconView.view:active {
background-color: rgba(172, 102, 21, 1);
}
XfdesktopIconView.view {
border-radius: 4px;
background-color: transparent;
color: white;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
XfdesktopIconView.view:active {
box-shadow: none;
text-shadow: none;
}
XfdesktopIconView.view .rubberband {
border-radius: 0;
}

View File

@ -1,79 +0,0 @@
import os, gi
gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
from gi.repository import GObject
class Dragging:
def __init__(self):
# higher values make movement more performant
# lower values make movement smoother
self.SENSITIVITY = 1
self.desktop = None
self.EvMask = Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON1_MOTION_MASK
self.offsetx = 0
self.offsety = 0
self.px = 0
self.py = 0
self.maxx = 0
self.maxy = 0
def connectEvents(self, desktop, widget):
self.desktop = desktop
widget.set_events(self.EvMask)
widget.connect("button_press_event", self.press_event)
widget.connect("motion_notify_event", self.draggingEvent)
widget.show()
def press_event(self, w, event):
if event.button == 1:
p = w.get_parent()
# offset == distance of parent widget from edge of screen ...
self.offsetx, self.offsety = p.get_window().get_position()
# plus distance from pointer to edge of widget
self.offsetx += event.x
self.offsety += event.y
# self.maxx, self.maxy both relative to the parent
# note that we're rounding down now so that these max values don't get
# rounded upward later and push the widget off the edge of its parent.
self.maxx = self.RoundDownToMultiple(p.get_allocation().width - w.get_allocation().width, self.SENSITIVITY)
self.maxy = self.RoundDownToMultiple(p.get_allocation().height - w.get_allocation().height, self.SENSITIVITY)
def draggingEvent(self, widget, event):
# x_root,x_root relative to screen
# x,y relative to parent (fixed widget)
# self.px,self.py stores previous values of x,y
# get starting values for x,y
x = event.x_root - self.offsetx
y = event.y_root - self.offsety
# make sure the potential coordinates x,y:
# 1) will not push any part of the widget outside of its parent container
# 2) is a multiple of self.SENSITIVITY
x = self.RoundToNearestMultiple(self.Max(self.Min(x, self.maxx), 0), self.SENSITIVITY)
y = self.RoundToNearestMultiple(self.Max(self.Min(y, self.maxy), 0), self.SENSITIVITY)
if x != self.px or y != self.py:
self.px = x
self.py = y
self.desktop.move(widget, x, y)
def Min(self, a, b):
if b < a:
return b
return a
def Max(self, a, b):
if b > a:
return b
return a
def RoundDownToMultiple(self, i, m):
return i/m*m
def RoundToNearestMultiple(self, i, m):
if i % m > m / 2:
return (i/m+1)*m
return i/m*m

View File

@ -1,93 +0,0 @@
import os, shutil, subprocess, threading
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
class FileHandler:
def __init__(self):
# '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')
# 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% ";
@threaded
def openFile(self, file):
print("Opening: " + file)
if file.lower().endswith(self.vids):
subprocess.Popen([self.MEDIAPLAYER, self.MPV_WH, file])
elif file.lower().endswith(self.music):
subprocess.Popen([self.MUSICPLAYER, file])
elif file.lower().endswith(self.images):
subprocess.Popen([self.IMGVIEWER, file])
elif file.lower().endswith(self.txt):
subprocess.Popen([self.TEXTVIEWER, file])
elif file.lower().endswith(self.pdf):
subprocess.Popen([self.PDFVIEWER, file])
elif file.lower().endswith(self.office):
subprocess.Popen([self.OFFICEPROG, file])
else:
subprocess.Popen(['xdg-open', file])
def createFile(self, newFileName):
pass
def updateFile(self, oldFileName, newFileName):
try:
print("Renaming...")
print(oldFileName + " --> " + newFileName)
os.rename(oldFileName, newFileName)
return 0
except Exception as e:
print("An error occured renaming the file:")
print(e)
return 1
def deleteFile(self, toDeleteFile):
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)
else:
print("An error occured deleting the file:")
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)
return 1
return 0
def copyFile(self):
pass
def cutFile(self):
pass
def pasteFile(self):
pass

View File

@ -1,167 +0,0 @@
# Gtk Imports
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gio as gio
from gi.repository import GdkPixbuf
from xdg.DesktopEntry import DesktopEntry
# Python Imports
import os, subprocess, hashlib, threading
from os.path import isdir, isfile, join
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
return wrapper
class Icon:
def __init__(self, settings):
self.settings = settings
self.thubnailGen = settings.getThumbnailGenerator()
self.vidsList = settings.returnVidsExtensionList()
self.imagesList = settings.returnImagesExtensionList()
self.GTK_ORIENTATION = settings.returnIconImagePos()
self.usrHome = settings.returnUserHome()
self.iconContainerWH = settings.returnContainerWH()
self.systemIconImageWH = settings.returnSystemIconImageWH()
self.viIconWH = settings.returnVIIconWH()
def createIcon(self, dir, file):
fullPath = dir + "/" + file
return self.getIconImage(file, fullPath)
def getIconImage(self, file, fullPath):
try:
thumbnl = None
# Video thumbnail
if file.lower().endswith(self.vidsList):
fileHash = hashlib.sha256(str.encode(fullPath)).hexdigest()
hashImgPth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
if isfile(hashImgPth) == False:
self.generateVideoThumbnail(fullPath, hashImgPth)
thumbnl = self.createIconImageBuffer(hashImgPth, self.viIconWH)
# Image Icon
elif file.lower().endswith(self.imagesList):
thumbnl = self.createIconImageBuffer(fullPath, self.viIconWH)
# .desktop file parsing
elif fullPath.lower().endswith( ('.desktop',) ):
thumbnl = self.parseDesktopFiles(fullPath)
# System icons
else:
thumbnl = self.getSystemThumbnail(fullPath, self.systemIconImageWH[0])
if thumbnl == None: # If no icon, try stock file icon...
thumbnl = gtk.Image.new_from_icon_name("gtk-file", gtk.IconSize.LARGE_TOOLBAR)
if thumbnl == None: # If no icon whatsoever, return internal default
thumbnl = gtk.Image.new_from_file("resources/icons/bin.png")
return thumbnl
except Exception as e:
print(e)
return gtk.Image.new_from_file("resources/icons/bin.png")
def parseDesktopFiles(self, fullPath):
try:
xdgObj = DesktopEntry(fullPath)
icon = xdgObj.getIcon()
iconsDirs = "/usr/share/icons"
altIconPath = ""
if "steam" in icon:
steamIconsDir = self.usrHome + "/.thumbnails/steam_icons/"
name = xdgObj.getName()
fileHash = hashlib.sha256(str.encode(name)).hexdigest()
if isdir(steamIconsDir) == False:
os.mkdir(steamIconsDir)
hashImgPth = steamIconsDir + fileHash + ".jpg"
if isfile(hashImgPth) == True:
# Use video sizes since headers are bigger
return self.createIconImageBuffer(hashImgPth, self.viIconWH)
execStr = xdgObj.getExec()
parts = execStr.split("steam://rungameid/")
id = parts[len(parts) - 1]
# NOTE: Can try this logic instead...
# if command exists use it instead of header image
# if "steamcmd app_info_print id":
# proc = subprocess.Popen(["steamcmd", "app_info_print", id])
# proc.wait()
# else:
# use the bottom logic
imageLink = "https://steamcdn-a.akamaihd.net/steam/apps/" + id + "/header.jpg"
proc = subprocess.Popen(["wget", "-O", hashImgPth, imageLink])
proc.wait()
# Use video sizes since headers are bigger
return self.createIconImageBuffer(hashImgPth, self.viIconWH)
elif os.path.exists(icon):
return self.createIconImageBuffer(icon, self.systemIconImageWH)
else:
for (dirpath, dirnames, filenames) in os.walk(iconsDirs):
for file in filenames:
appNM = "application-x-" + icon
if appNM in file:
altIconPath = dirpath + "/" + file
break
return self.createIconImageBuffer(altIconPath, self.systemIconImageWH)
except Exception as e:
print(e)
return None
def getSystemThumbnail(self, filename, size):
try:
iconPath = None
if os.path.exists(filename):
file = gio.File.new_for_path(filename)
info = file.query_info('standard::icon' , 0 , gio.Cancellable())
icon = info.get_icon().get_names()[0]
iconTheme = gtk.IconTheme.get_default()
iconFile = iconTheme.lookup_icon(icon , size , 0)
if iconFile != None:
iconPath = iconFile.get_filename()
return self.createIconImageBuffer(iconPath, self.systemIconImageWH)
else:
return None
else:
return None
except Exception as e:
print(e)
return None
def createIconImageBuffer(self, path, wxh):
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(path, wxh[0], wxh[1], False)
except Exception as e:
return None
return gtk.Image.new_from_pixbuf(pixbuf)
def generateVideoThumbnail(self, fullPath, hashImgPth):
try:
proc = subprocess.Popen([self.thubnailGen, "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPath, "-o", hashImgPth])
proc.wait()
except Exception as e:
print(e)

View File

@ -1,139 +0,0 @@
# Gtk Imports
import gi, cairo, os
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import Gdk as gdk
class Settings:
def __init__(self):
self.builder = None
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')
def attachBuilder(self, builder):
self.builder = builder
self.builder.add_from_file("resources/PyTop.glade")
def createWindow(self):
# Get window and connect signals
window = self.builder.get_object("Window")
window.connect("delete-event", gtk.main_quit)
self.setWindowData(window)
return window
def setWindowData(self, window):
screen = window.get_screen()
visual = screen.get_rgba_visual()
if visual != None and screen.is_composited():
window.set_visual(visual)
# bind css file
cssProvider = gtk.CssProvider()
cssProvider.load_from_path('resources/stylesheet.css')
screen = gdk.Screen.get_default()
styleContext = gtk.StyleContext()
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
window.set_app_paintable(True)
monitors = self.getMonitorData(screen)
window.resize(monitors[0].width, monitors[0].height)
def getMonitorData(self, screen):
monitors = []
for m in range(screen.get_n_monitors()):
monitors.append(screen.get_monitor_geometry(m))
for monitor in monitors:
print(str(monitor.width) + "x" + str(monitor.height) + "+" + str(monitor.x) + "+" + str(monitor.y))
return monitors
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)
# 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)

View File

@ -1,6 +0,0 @@
from utils.Dragging import Dragging
from utils.Settings import Settings
from utils.Events import Events
from utils.Grid import Grid
from utils.Icon import Icon
from utils.FileHandler import FileHandler