diff --git a/bin/pytop-0-0-1-x64.deb b/bin/pytop-0-0-1-x64.deb
index b408fd7..c21dd68 100644
Binary files a/bin/pytop-0-0-1-x64.deb and b/bin/pytop-0-0-1-x64.deb differ
diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/PyTop.py b/src/debs/pytop-0-0-1-x64/opt/Pytop/PyTop.py
index 87c533e..ba52412 100755
--- a/src/debs/pytop-0-0-1-x64/opt/Pytop/PyTop.py
+++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/PyTop.py
@@ -28,10 +28,6 @@ class Main:
window.show_all()
-
-
-
-
if __name__ == "__main__":
main = Main()
gtk.main()
diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/PyTop.glade b/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/PyTop.glade
index ec53c29..ec4d51b 100644
--- a/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/PyTop.glade
+++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/PyTop.glade
@@ -8,108 +8,6 @@
inode/directory
-
-
True
False
@@ -125,7 +23,6 @@
desktop
False
center
-
@@ -190,17 +87,6 @@
0
-
-
- True
- False
-
-
- False
- True
- 1
-
-
True
@@ -223,12 +109,114 @@
True
True
- 2
+ 1
+
False
True
diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Events.py b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Events.py
index aac0413..fbd3962 100644
--- a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Events.py
+++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Events.py
@@ -1,8 +1,5 @@
# Gtk Imports
-import gi
-gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk as gtk
# Python imports
from .Grid import Grid
@@ -32,10 +29,6 @@ class Events:
newPath = widget.get_filename()
Grid(self.desktop, self.settings, newPath)
- def showGridControlMenu(self, widget, data=None):
- popover = self.builder.get_object("gridControlMenu")
- popover.show_all()
- popover.popup()
# File control events
@@ -61,9 +54,6 @@ class Events:
def pasteFile(self):
pass
- def test(self, widget, data=None):
- print(widget)
-
# Webview events
def showWebview(self, widget):
self.builder.get_object("webViewer").popup()
diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Grid.py b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Grid.py
index 793a37b..82664d4 100644
--- a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Grid.py
+++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Grid.py
@@ -7,8 +7,8 @@ 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
-from gi.repository import GObject as gobject
# Python imports
import os, threading
@@ -18,8 +18,6 @@ from .Icon import Icon
from .FileHandler import FileHandler
-gdk.threads_init()
-
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
@@ -46,7 +44,6 @@ class Grid:
self.setIconViewDir(newPath)
- @threaded
def setIconViewDir(self, path):
self.store.clear()
@@ -69,25 +66,13 @@ class Grid:
files = dirPaths + files
self.generateDirectoryGrid(path, files)
+ @threaded
def generateDirectoryGrid(self, dirPath, files):
- fractionTick = 1.0 / 1.0 if len(files) == 0 else len(files)
- tickCount = 0.0
- row = 0
- col = 0
- x = 0
- y = 0
-
- loadProgress = self.builder.get_object('loadProgress')
- loadProgress.set_text("Loading...")
- loadProgress.set_fraction(0.0)
-
for file in files:
- imgBuffer = Icon(self.settings).createIcon(dirPath, file)
- gobject.idle_add(self.addToGrid, (imgBuffer, file,))
- # tickCount += fractionTick
- # loadProgress.set_fraction(tickCount)
-
- loadProgress.set_text("Finished...")
+ image = Icon(self.settings).createIcon(dirPath, file)
+ # NOTE: Passing pixbuf after retreval to keep Icon.py file more universaly usable.
+ # We can just remove get_pixbuf to get a gtk image
+ glib.idle_add(self.addToGrid, (image.get_pixbuf(), file,))
def addToGrid(self, args):
self.store.append([args[0], args[1]])
@@ -116,6 +101,11 @@ class Grid:
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()
+ print(popover)
+
# # NOTE: Need to change name of listview box...
# children = widget.get_children()[0].get_children()
# fileName = children[1].get_text()
@@ -123,14 +113,14 @@ class Grid:
# file = dir + "/" + fileName
#
# input = self.builder.get_object("iconRenameInput")
- popover = self.builder.get_object("iconControlsWindow")
+ # 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()
+ # popover.set_relative_to(widget)
+ # popover.set_position(gtk.PositionType.RIGHT)
+ # popover.show_all()
+ # popover.popup()
except Exception as e:
print(e)
diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Icon.py b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Icon.py
index 882ec4f..4130e4a 100644
--- a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Icon.py
+++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Icon.py
@@ -29,61 +29,55 @@ class Icon:
self.viIconWxH = settings.returnVIIconWH()
def createIcon(self, dir, file):
- fullPathFile = dir + "/" + file
- thumbnl = self.getIconImage(file, fullPathFile)
+ fullPath = dir + "/" + file
+ thumbnl = self.getIconImage(file, fullPath)
return thumbnl
- def getIconImage(self, file, fullPathFile):
+ def getIconImage(self, file, fullPath):
thumbnl = gtk.Image()
vidsList = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
imagesList = ('.png', '.jpg', '.jpeg', '.gif')
- if file.lower().endswith(vidsList):
- fileHash = hashlib.sha256(str.encode(fullPathFile)).hexdigest()
- hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
+ try:
+ if file.lower().endswith(vidsList):
+ fileHash = hashlib.sha256(str.encode(fullPath)).hexdigest()
+ hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
- # Generate any thumbnails beforehand...
- try:
if isfile(hashImgpth) == False:
- self.generateVideoThumbnail(fullPathFile, hashImgpth)
- thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
- else:
- thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
- except Exception as e:
- print(e)
- thumbPth = self.getSystemThumbnail(fullPathFile, self.systemIconImageWxH[0])
- thumbnl = self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
+ self.generateVideoThumbnail(fullPath, hashImgpth)
- elif file.lower().endswith(imagesList):
- thumbnl = self.createIconImageBuffer(fullPathFile, self.viIconWxH)
- else:
- try:
- thumbPth = self.getSystemThumbnail(fullPathFile, self.systemIconImageWxH[0])
- thumbnl = self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
- except Exception as e:
- print(e)
- thumbnl = gtk.Image(stock = gtk.STOCK_DIALOG_ERROR)
+ thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
+ elif file.lower().endswith(imagesList):
+ thumbnl = self.createIconImageBuffer(fullPath, self.viIconWxH)
+ else:
+ thumbnl = self.nonImageOrVideoIcon(fullPath)
+ except Exception as e:
+ return gtk.Image.new_from_file("resources/icons/bin.png")
- # NOTE: Returning pixbuf through retreval to keep this file more universaly usable.
- # We can just remove get_pixbuf to get a gtk image
- return thumbnl.get_pixbuf()
+ if thumbnl == None: # If no system icon, try stock file icon...
+ thumbnl = gtk.Image.new_from_icon_name("gtk-file", gtk.IconSize.LARGE_TOOLBAR)
+ if thumbnl == None:
+ thumbnl = gtk.Image.new_from_file("resources/icons/bin.png")
+
+ return thumbnl
+
+ def nonImageOrVideoIcon(self, fullPath):
+ thumbPth = self.getSystemThumbnail(fullPath, self.systemIconImageWxH[0])
+ return self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
def createIconImageBuffer(self, path, wxh):
pixbuf = None
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
- filename = path,
- width = wxh[0],
- height = wxh[1],
- # preserve_aspect_ratio = False)
- preserve_aspect_ratio = True)
+ filename = path,
+ width = wxh[0],
+ height = wxh[1],
+ preserve_aspect_ratio = False)
return gtk.Image.new_from_pixbuf(pixbuf)
except Exception as e:
- print(e)
+ return gtk.Image.new_from_file("resources/icons/bin.png")
- return gtk.Image(stock = gtk.STOCK_DIALOG_ERROR)
-
- def getSystemThumbnail(self, filename,size):
+ def getSystemThumbnail(self, filename, size):
final_filename = ""
if os.path.exists(filename):
file = gio.File.new_for_path(filename)
@@ -97,6 +91,6 @@ class Icon:
return final_filename
- def generateVideoThumbnail(self, fullPathFile, hashImgpth):
- proc = subprocess.Popen([self.thubnailGen, "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", hashImgpth])
+ def generateVideoThumbnail(self, fullPath, hashImgpth):
+ proc = subprocess.Popen([self.thubnailGen, "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPath, "-o", hashImgpth])
proc.wait()
diff --git a/src/versions/pytop-0.0.1/Pytop/PyTop.py b/src/versions/pytop-0.0.1/Pytop/PyTop.py
index 87c533e..ba52412 100755
--- a/src/versions/pytop-0.0.1/Pytop/PyTop.py
+++ b/src/versions/pytop-0.0.1/Pytop/PyTop.py
@@ -28,10 +28,6 @@ class Main:
window.show_all()
-
-
-
-
if __name__ == "__main__":
main = Main()
gtk.main()
diff --git a/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade b/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade
index ec53c29..ec4d51b 100644
--- a/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade
+++ b/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade
@@ -8,108 +8,6 @@
inode/directory
-
-
- False
-
-
- True
- False
- vertical
-
-
- 300
- 26
- True
- True
- gtk-edit
-
-
- False
- True
- 0
-
-
-
-
- True
- False
-
-
- gtk-copy
- True
- True
- True
- True
- True
-
-
- False
- True
- 0
-
-
-
-
- gtk-cut
- True
- True
- True
- True
- True
-
-
- False
- True
- 1
-
-
-
-
-
-
-
- gtk-delete
- True
- True
- True
- 65
- True
- True
-
-
- False
- True
- 3
-
-
-
-
- False
- True
- 1
-
-
-
-
-
True
False
@@ -125,7 +23,6 @@
desktop
False
center
-
@@ -190,17 +87,6 @@
0
-
-
- True
- False
-
-
- False
- True
- 1
-
-
True
@@ -223,12 +109,114 @@
True
True
- 2
+ 1
+
False
True
diff --git a/src/versions/pytop-0.0.1/Pytop/utils/Events.py b/src/versions/pytop-0.0.1/Pytop/utils/Events.py
index aac0413..fbd3962 100644
--- a/src/versions/pytop-0.0.1/Pytop/utils/Events.py
+++ b/src/versions/pytop-0.0.1/Pytop/utils/Events.py
@@ -1,8 +1,5 @@
# Gtk Imports
-import gi
-gi.require_version('Gtk', '3.0')
-from gi.repository import Gtk as gtk
# Python imports
from .Grid import Grid
@@ -32,10 +29,6 @@ class Events:
newPath = widget.get_filename()
Grid(self.desktop, self.settings, newPath)
- def showGridControlMenu(self, widget, data=None):
- popover = self.builder.get_object("gridControlMenu")
- popover.show_all()
- popover.popup()
# File control events
@@ -61,9 +54,6 @@ class Events:
def pasteFile(self):
pass
- def test(self, widget, data=None):
- print(widget)
-
# Webview events
def showWebview(self, widget):
self.builder.get_object("webViewer").popup()
diff --git a/src/versions/pytop-0.0.1/Pytop/utils/Grid.py b/src/versions/pytop-0.0.1/Pytop/utils/Grid.py
index 793a37b..82664d4 100644
--- a/src/versions/pytop-0.0.1/Pytop/utils/Grid.py
+++ b/src/versions/pytop-0.0.1/Pytop/utils/Grid.py
@@ -7,8 +7,8 @@ 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
-from gi.repository import GObject as gobject
# Python imports
import os, threading
@@ -18,8 +18,6 @@ from .Icon import Icon
from .FileHandler import FileHandler
-gdk.threads_init()
-
def threaded(fn):
def wrapper(*args, **kwargs):
threading.Thread(target=fn, args=args, kwargs=kwargs).start()
@@ -46,7 +44,6 @@ class Grid:
self.setIconViewDir(newPath)
- @threaded
def setIconViewDir(self, path):
self.store.clear()
@@ -69,25 +66,13 @@ class Grid:
files = dirPaths + files
self.generateDirectoryGrid(path, files)
+ @threaded
def generateDirectoryGrid(self, dirPath, files):
- fractionTick = 1.0 / 1.0 if len(files) == 0 else len(files)
- tickCount = 0.0
- row = 0
- col = 0
- x = 0
- y = 0
-
- loadProgress = self.builder.get_object('loadProgress')
- loadProgress.set_text("Loading...")
- loadProgress.set_fraction(0.0)
-
for file in files:
- imgBuffer = Icon(self.settings).createIcon(dirPath, file)
- gobject.idle_add(self.addToGrid, (imgBuffer, file,))
- # tickCount += fractionTick
- # loadProgress.set_fraction(tickCount)
-
- loadProgress.set_text("Finished...")
+ image = Icon(self.settings).createIcon(dirPath, file)
+ # NOTE: Passing pixbuf after retreval to keep Icon.py file more universaly usable.
+ # We can just remove get_pixbuf to get a gtk image
+ glib.idle_add(self.addToGrid, (image.get_pixbuf(), file,))
def addToGrid(self, args):
self.store.append([args[0], args[1]])
@@ -116,6 +101,11 @@ class Grid:
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()
+ print(popover)
+
# # NOTE: Need to change name of listview box...
# children = widget.get_children()[0].get_children()
# fileName = children[1].get_text()
@@ -123,14 +113,14 @@ class Grid:
# file = dir + "/" + fileName
#
# input = self.builder.get_object("iconRenameInput")
- popover = self.builder.get_object("iconControlsWindow")
+ # 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()
+ # popover.set_relative_to(widget)
+ # popover.set_position(gtk.PositionType.RIGHT)
+ # popover.show_all()
+ # popover.popup()
except Exception as e:
print(e)
diff --git a/src/versions/pytop-0.0.1/Pytop/utils/Icon.py b/src/versions/pytop-0.0.1/Pytop/utils/Icon.py
index 882ec4f..4130e4a 100644
--- a/src/versions/pytop-0.0.1/Pytop/utils/Icon.py
+++ b/src/versions/pytop-0.0.1/Pytop/utils/Icon.py
@@ -29,61 +29,55 @@ class Icon:
self.viIconWxH = settings.returnVIIconWH()
def createIcon(self, dir, file):
- fullPathFile = dir + "/" + file
- thumbnl = self.getIconImage(file, fullPathFile)
+ fullPath = dir + "/" + file
+ thumbnl = self.getIconImage(file, fullPath)
return thumbnl
- def getIconImage(self, file, fullPathFile):
+ def getIconImage(self, file, fullPath):
thumbnl = gtk.Image()
vidsList = ('.mkv', '.avi', '.flv', '.mov', '.m4v', '.mpg', '.wmv', '.mpeg', '.mp4', '.webm')
imagesList = ('.png', '.jpg', '.jpeg', '.gif')
- if file.lower().endswith(vidsList):
- fileHash = hashlib.sha256(str.encode(fullPathFile)).hexdigest()
- hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
+ try:
+ if file.lower().endswith(vidsList):
+ fileHash = hashlib.sha256(str.encode(fullPath)).hexdigest()
+ hashImgpth = self.usrHome + "/.thumbnails/normal/" + fileHash + ".png"
- # Generate any thumbnails beforehand...
- try:
if isfile(hashImgpth) == False:
- self.generateVideoThumbnail(fullPathFile, hashImgpth)
- thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
- else:
- thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
- except Exception as e:
- print(e)
- thumbPth = self.getSystemThumbnail(fullPathFile, self.systemIconImageWxH[0])
- thumbnl = self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
+ self.generateVideoThumbnail(fullPath, hashImgpth)
- elif file.lower().endswith(imagesList):
- thumbnl = self.createIconImageBuffer(fullPathFile, self.viIconWxH)
- else:
- try:
- thumbPth = self.getSystemThumbnail(fullPathFile, self.systemIconImageWxH[0])
- thumbnl = self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
- except Exception as e:
- print(e)
- thumbnl = gtk.Image(stock = gtk.STOCK_DIALOG_ERROR)
+ thumbnl = self.createIconImageBuffer(hashImgpth, self.viIconWxH)
+ elif file.lower().endswith(imagesList):
+ thumbnl = self.createIconImageBuffer(fullPath, self.viIconWxH)
+ else:
+ thumbnl = self.nonImageOrVideoIcon(fullPath)
+ except Exception as e:
+ return gtk.Image.new_from_file("resources/icons/bin.png")
- # NOTE: Returning pixbuf through retreval to keep this file more universaly usable.
- # We can just remove get_pixbuf to get a gtk image
- return thumbnl.get_pixbuf()
+ if thumbnl == None: # If no system icon, try stock file icon...
+ thumbnl = gtk.Image.new_from_icon_name("gtk-file", gtk.IconSize.LARGE_TOOLBAR)
+ if thumbnl == None:
+ thumbnl = gtk.Image.new_from_file("resources/icons/bin.png")
+
+ return thumbnl
+
+ def nonImageOrVideoIcon(self, fullPath):
+ thumbPth = self.getSystemThumbnail(fullPath, self.systemIconImageWxH[0])
+ return self.createIconImageBuffer(thumbPth, self.systemIconImageWxH)
def createIconImageBuffer(self, path, wxh):
pixbuf = None
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(
- filename = path,
- width = wxh[0],
- height = wxh[1],
- # preserve_aspect_ratio = False)
- preserve_aspect_ratio = True)
+ filename = path,
+ width = wxh[0],
+ height = wxh[1],
+ preserve_aspect_ratio = False)
return gtk.Image.new_from_pixbuf(pixbuf)
except Exception as e:
- print(e)
+ return gtk.Image.new_from_file("resources/icons/bin.png")
- return gtk.Image(stock = gtk.STOCK_DIALOG_ERROR)
-
- def getSystemThumbnail(self, filename,size):
+ def getSystemThumbnail(self, filename, size):
final_filename = ""
if os.path.exists(filename):
file = gio.File.new_for_path(filename)
@@ -97,6 +91,6 @@ class Icon:
return final_filename
- def generateVideoThumbnail(self, fullPathFile, hashImgpth):
- proc = subprocess.Popen([self.thubnailGen, "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPathFile, "-o", hashImgpth])
+ def generateVideoThumbnail(self, fullPath, hashImgpth):
+ proc = subprocess.Popen([self.thubnailGen, "-t", "65%", "-s", "300", "-c", "jpg", "-i", fullPath, "-o", hashImgpth])
proc.wait()