diff --git a/bin/pytop-0-0-1-x64.deb b/bin/pytop-0-0-1-x64.deb index 75e21a3..b408fd7 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 ba52412..87c533e 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,6 +28,10 @@ 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 f7d25bb..ec53c29 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 @@ -28,47 +28,18 @@ False - right True False vertical - + + 300 + 26 True - False - - - 300 - 26 - True - True - gtk-edit - - - - False - True - 0 - - - - - gtk-save - True - True - True - True - True - - - - False - True - 1 - - + True + gtk-edit False @@ -82,14 +53,12 @@ False - gtk-delete + gtk-copy True True True - 65 True True - False @@ -97,9 +66,6 @@ 0 - - - gtk-cut @@ -112,15 +78,19 @@ False True - 2 + 1 + + + - gtk-copy + gtk-delete True True True + 65 True True @@ -140,12 +110,6 @@ - - True - False - gtk-go-up - 3 - True False @@ -191,7 +155,22 @@ - + + True + False + select-folder + Folders + Directory Chooser + + + + False + True + 1 + + + + True True edit-find-symbolic @@ -201,40 +180,9 @@ True True - 1 - - - - - True - True - True - Up - upImage - True - - - - False - True 2 - - - True - False - select-folder - Folders - Directory Chooser - - - - False - True - 3 - - False @@ -246,7 +194,6 @@ True False - True False @@ -264,17 +211,10 @@ True False - + True True - False - False - True - both - - - - + 6 diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/stylesheet.css b/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/stylesheet.css index e0240db..8095bf3 100644 --- a/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/stylesheet.css +++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/resources/stylesheet.css @@ -20,6 +20,17 @@ iconview { treeview, treeview.view { - background: rgba(0, 0, 0, 0.64); - background-color: rgba(0, 0, 0, 0.64); + 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); } 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 988dda0..aac0413 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,5 +1,8 @@ # Gtk Imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk as gtk # Python imports from .Grid import Grid @@ -25,18 +28,9 @@ class Events: self.grid = None self.setIconViewDir(selectedDirDialog) - def setIconViewDir(self, widget, data=None): newPath = widget.get_filename() - self.grid = Grid(self.desktop, self.settings, newPath) - - def dirUp(self, widget, data=None): - newPath = self.grid.returnParentDir() - self.grid = Grid(self.desktop, self.settings, newPath) - - def iconLeftClickEventManager(self, widget, eve, item): - self.grid.iconLeftClickEventManager(widget, eve, item) - + Grid(self.desktop, self.settings, newPath) def showGridControlMenu(self, widget, data=None): popover = self.builder.get_object("gridControlMenu") 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 c213e6e..793a37b 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 @@ -8,7 +8,7 @@ gi.require_version('Gdk', '3.0') from gi.repository import Gtk as gtk from gi.repository import Gdk as gdk from gi.repository import GdkPixbuf -from gi.repository import GLib +from gi.repository import GObject as gobject # Python imports import os, threading @@ -18,6 +18,8 @@ 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() @@ -29,42 +31,27 @@ class Grid: self.settings = settings self.filehandler = FileHandler() - self.store = gtk.TreeStore(str, GdkPixbuf.Pixbuf) + self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str) self.usrHome = settings.returnUserHome() self.builder = self.settings.returnBuilder() self.ColumnSize = self.settings.returnColumnSize() self.currentPath = "" self.selectedFile = "" - self.treeViewCol = None - self.desktop.set_model(self.store) - if len(self.desktop.get_columns()) == 0: - self.treeViewCol = gtk.TreeViewColumn("Files") - # Create a column cell to display text - colCellText = gtk.CellRendererText() - # Create a column cell to display an image - colCellImg = gtk.CellRendererPixbuf() - # Add the cells to the column - self.treeViewCol.pack_start(colCellImg, False) - self.treeViewCol.pack_start(colCellText, True) - # Bind the text cell to column 0 of the tree's model - self.treeViewCol.add_attribute(colCellText, "text", 0) - # Bind the image cell to column 1 of the tree's model - self.treeViewCol.add_attribute(colCellImg, "pixbuf", 1) - # Append the columns to the TreeView - self.desktop.append_column(self.treeViewCol) - else: - self.treeViewCol = self.desktop.get_column(0) + 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.setIconViewDir(newPath) - + @threaded def setIconViewDir(self, path): - # self.treeViewCol.clear() self.store.clear() self.currentPath = path - paths = ['.', '..'] + dirPaths = ['.', '..'] files = [] for f in listdir(path): @@ -75,49 +62,42 @@ class Grid: if isfile(file): files.append(f) else: - paths.append(f) + dirPaths.append(f) - paths.sort() + dirPaths.sort() files.sort() - files = paths + files + files = dirPaths + files self.generateDirectoryGrid(path, files) - @threaded - def generateDirectoryGrid(self, path, files): + 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 = self.getImgBuffer(path, file) - GLib.idle_add(self.addToGrid, (imgBuffer, file,)) + imgBuffer = Icon(self.settings).createIcon(dirPath, file) + gobject.idle_add(self.addToGrid, (imgBuffer, file,)) # tickCount += fractionTick - loadProgress.set_fraction(tickCount) + # loadProgress.set_fraction(tickCount) + loadProgress.set_text("Finished...") - def getImgBuffer(self, path, file): - return Icon(self.settings).createIcon(path, file) - - def addToGrid(self, args, parent=None): - # NOTE: Converting to pixbuf after retreval to keep Icon.py more universal. - # We can just remove get_pixbuf to get a gtk image. - # We probably need a settings check to chose a set type... - self.store.append(parent, [args[1], args[0].get_pixbuf()]) - - - def iconLeftClickEventManager(self, widget, eve, item): - tree_selection = self.desktop.get_selection() - (model, pathlist) = tree_selection.get_selected_rows() - fileName = None - dir = self.currentPath - for path in pathlist : - tree_iter = model.get_iter(path) - fileName = model.get_value(tree_iter,0) + def addToGrid(self, args): + self.store.append([args[0], args[1]]) + def iconLeftClickEventManager(self, widget, item): try: - file = dir + "/" + fileName + model = widget.get_model() + fileName = model[item][1] + dir = self.currentPath + file = dir + "/" + fileName if fileName == ".": self.setIconViewDir(dir) @@ -155,9 +135,6 @@ class Grid: print(e) - def returnParentDir(self): - return os.path.abspath(os.path.join(self.currentPath, os.pardir)) - # Passthrough file control events def createFile(arg): pass 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 d6a377a..882ec4f 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 @@ -64,7 +64,9 @@ class Icon: print(e) thumbnl = gtk.Image(stock = gtk.STOCK_DIALOG_ERROR) - return thumbnl + # 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() def createIconImageBuffer(self, path, wxh): pixbuf = None @@ -73,6 +75,7 @@ class Icon: filename = path, width = wxh[0], height = wxh[1], + # preserve_aspect_ratio = False) preserve_aspect_ratio = True) return gtk.Image.new_from_pixbuf(pixbuf) except Exception as e: diff --git a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Settings.py b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Settings.py index 4f3638f..e5ac13c 100644 --- a/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Settings.py +++ b/src/debs/pytop-0-0-1-x64/opt/Pytop/utils/Settings.py @@ -44,6 +44,13 @@ class Settings: 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) window.connect("draw", self.area_draw) monitors = self.getMonitorData(screen) diff --git a/src/versions/pytop-0.0.1/Pytop/PyTop.py b/src/versions/pytop-0.0.1/Pytop/PyTop.py index ba52412..87c533e 100755 --- a/src/versions/pytop-0.0.1/Pytop/PyTop.py +++ b/src/versions/pytop-0.0.1/Pytop/PyTop.py @@ -28,6 +28,10 @@ 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 f7d25bb..ec53c29 100644 --- a/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade +++ b/src/versions/pytop-0.0.1/Pytop/resources/PyTop.glade @@ -28,47 +28,18 @@ False - right True False vertical - + + 300 + 26 True - False - - - 300 - 26 - True - True - gtk-edit - - - - False - True - 0 - - - - - gtk-save - True - True - True - True - True - - - - False - True - 1 - - + True + gtk-edit False @@ -82,14 +53,12 @@ False - gtk-delete + gtk-copy True True True - 65 True True - False @@ -97,9 +66,6 @@ 0 - - - gtk-cut @@ -112,15 +78,19 @@ False True - 2 + 1 + + + - gtk-copy + gtk-delete True True True + 65 True True @@ -140,12 +110,6 @@ - - True - False - gtk-go-up - 3 - True False @@ -191,7 +155,22 @@ - + + True + False + select-folder + Folders + Directory Chooser + + + + False + True + 1 + + + + True True edit-find-symbolic @@ -201,40 +180,9 @@ True True - 1 - - - - - True - True - True - Up - upImage - True - - - - False - True 2 - - - True - False - select-folder - Folders - Directory Chooser - - - - False - True - 3 - - False @@ -246,7 +194,6 @@ True False - True False @@ -264,17 +211,10 @@ True False - + True True - False - False - True - both - - - - + 6 diff --git a/src/versions/pytop-0.0.1/Pytop/resources/stylesheet.css b/src/versions/pytop-0.0.1/Pytop/resources/stylesheet.css index e0240db..8095bf3 100644 --- a/src/versions/pytop-0.0.1/Pytop/resources/stylesheet.css +++ b/src/versions/pytop-0.0.1/Pytop/resources/stylesheet.css @@ -20,6 +20,17 @@ iconview { treeview, treeview.view { - background: rgba(0, 0, 0, 0.64); - background-color: rgba(0, 0, 0, 0.64); + 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); } 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 988dda0..aac0413 100644 --- a/src/versions/pytop-0.0.1/Pytop/utils/Events.py +++ b/src/versions/pytop-0.0.1/Pytop/utils/Events.py @@ -1,5 +1,8 @@ # Gtk Imports +import gi +gi.require_version('Gtk', '3.0') +from gi.repository import Gtk as gtk # Python imports from .Grid import Grid @@ -25,18 +28,9 @@ class Events: self.grid = None self.setIconViewDir(selectedDirDialog) - def setIconViewDir(self, widget, data=None): newPath = widget.get_filename() - self.grid = Grid(self.desktop, self.settings, newPath) - - def dirUp(self, widget, data=None): - newPath = self.grid.returnParentDir() - self.grid = Grid(self.desktop, self.settings, newPath) - - def iconLeftClickEventManager(self, widget, eve, item): - self.grid.iconLeftClickEventManager(widget, eve, item) - + Grid(self.desktop, self.settings, newPath) def showGridControlMenu(self, widget, data=None): popover = self.builder.get_object("gridControlMenu") 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 c213e6e..793a37b 100644 --- a/src/versions/pytop-0.0.1/Pytop/utils/Grid.py +++ b/src/versions/pytop-0.0.1/Pytop/utils/Grid.py @@ -8,7 +8,7 @@ gi.require_version('Gdk', '3.0') from gi.repository import Gtk as gtk from gi.repository import Gdk as gdk from gi.repository import GdkPixbuf -from gi.repository import GLib +from gi.repository import GObject as gobject # Python imports import os, threading @@ -18,6 +18,8 @@ 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() @@ -29,42 +31,27 @@ class Grid: self.settings = settings self.filehandler = FileHandler() - self.store = gtk.TreeStore(str, GdkPixbuf.Pixbuf) + self.store = gtk.ListStore(GdkPixbuf.Pixbuf, str) self.usrHome = settings.returnUserHome() self.builder = self.settings.returnBuilder() self.ColumnSize = self.settings.returnColumnSize() self.currentPath = "" self.selectedFile = "" - self.treeViewCol = None - self.desktop.set_model(self.store) - if len(self.desktop.get_columns()) == 0: - self.treeViewCol = gtk.TreeViewColumn("Files") - # Create a column cell to display text - colCellText = gtk.CellRendererText() - # Create a column cell to display an image - colCellImg = gtk.CellRendererPixbuf() - # Add the cells to the column - self.treeViewCol.pack_start(colCellImg, False) - self.treeViewCol.pack_start(colCellText, True) - # Bind the text cell to column 0 of the tree's model - self.treeViewCol.add_attribute(colCellText, "text", 0) - # Bind the image cell to column 1 of the tree's model - self.treeViewCol.add_attribute(colCellImg, "pixbuf", 1) - # Append the columns to the TreeView - self.desktop.append_column(self.treeViewCol) - else: - self.treeViewCol = self.desktop.get_column(0) + 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.setIconViewDir(newPath) - + @threaded def setIconViewDir(self, path): - # self.treeViewCol.clear() self.store.clear() self.currentPath = path - paths = ['.', '..'] + dirPaths = ['.', '..'] files = [] for f in listdir(path): @@ -75,49 +62,42 @@ class Grid: if isfile(file): files.append(f) else: - paths.append(f) + dirPaths.append(f) - paths.sort() + dirPaths.sort() files.sort() - files = paths + files + files = dirPaths + files self.generateDirectoryGrid(path, files) - @threaded - def generateDirectoryGrid(self, path, files): + 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 = self.getImgBuffer(path, file) - GLib.idle_add(self.addToGrid, (imgBuffer, file,)) + imgBuffer = Icon(self.settings).createIcon(dirPath, file) + gobject.idle_add(self.addToGrid, (imgBuffer, file,)) # tickCount += fractionTick - loadProgress.set_fraction(tickCount) + # loadProgress.set_fraction(tickCount) + loadProgress.set_text("Finished...") - def getImgBuffer(self, path, file): - return Icon(self.settings).createIcon(path, file) - - def addToGrid(self, args, parent=None): - # NOTE: Converting to pixbuf after retreval to keep Icon.py more universal. - # We can just remove get_pixbuf to get a gtk image. - # We probably need a settings check to chose a set type... - self.store.append(parent, [args[1], args[0].get_pixbuf()]) - - - def iconLeftClickEventManager(self, widget, eve, item): - tree_selection = self.desktop.get_selection() - (model, pathlist) = tree_selection.get_selected_rows() - fileName = None - dir = self.currentPath - for path in pathlist : - tree_iter = model.get_iter(path) - fileName = model.get_value(tree_iter,0) + def addToGrid(self, args): + self.store.append([args[0], args[1]]) + def iconLeftClickEventManager(self, widget, item): try: - file = dir + "/" + fileName + model = widget.get_model() + fileName = model[item][1] + dir = self.currentPath + file = dir + "/" + fileName if fileName == ".": self.setIconViewDir(dir) @@ -155,9 +135,6 @@ class Grid: print(e) - def returnParentDir(self): - return os.path.abspath(os.path.join(self.currentPath, os.pardir)) - # Passthrough file control events def createFile(arg): pass 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 d6a377a..882ec4f 100644 --- a/src/versions/pytop-0.0.1/Pytop/utils/Icon.py +++ b/src/versions/pytop-0.0.1/Pytop/utils/Icon.py @@ -64,7 +64,9 @@ class Icon: print(e) thumbnl = gtk.Image(stock = gtk.STOCK_DIALOG_ERROR) - return thumbnl + # 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() def createIconImageBuffer(self, path, wxh): pixbuf = None @@ -73,6 +75,7 @@ class Icon: filename = path, width = wxh[0], height = wxh[1], + # preserve_aspect_ratio = False) preserve_aspect_ratio = True) return gtk.Image.new_from_pixbuf(pixbuf) except Exception as e: diff --git a/src/versions/pytop-0.0.1/Pytop/utils/Settings.py b/src/versions/pytop-0.0.1/Pytop/utils/Settings.py index 4f3638f..e5ac13c 100644 --- a/src/versions/pytop-0.0.1/Pytop/utils/Settings.py +++ b/src/versions/pytop-0.0.1/Pytop/utils/Settings.py @@ -44,6 +44,13 @@ class Settings: 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) window.connect("draw", self.area_draw) monitors = self.getMonitorData(screen)