diff --git a/bin/pytop-0-0-1-x64.deb b/bin/pytop-0-0-1-x64.deb index 491b1d9..cb9485a 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/Pytop/resources/PyTop.glade b/src/Pytop/resources/PyTop.glade index 7764d81..2423801 100644 --- a/src/Pytop/resources/PyTop.glade +++ b/src/Pytop/resources/PyTop.glade @@ -143,8 +143,22 @@ False gtk-new - + False + False + True + mouse + True + splashscreen + True + True + False + False + north + + + + True @@ -281,8 +295,12 @@ False True center + True splashscreen + True + True False + False center diff --git a/src/Pytop/signal_classes/TaskbarSignals.py b/src/Pytop/signal_classes/TaskbarSignals.py index 5f2d663..5550d4d 100644 --- a/src/Pytop/signal_classes/TaskbarSignals.py +++ b/src/Pytop/signal_classes/TaskbarSignals.py @@ -63,8 +63,6 @@ class TaskbarSignals: def setScreenSignals(self): self.SCREEN.connect("active-workspace-changed", self.activeWorkspaceChanged) - # self.SCREEN.connect("application-opened", self.applicationOpened) - # self.SCREEN.connect("application-closed", self.applicationClosed) self.SCREEN.connect("window-opened", self.windowOpened) self.SCREEN.connect("window-closed", self.windowClosed) @@ -84,8 +82,10 @@ class TaskbarSignals: window.activate(1) if e.type == gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON: self.window = window - self.taskbarMenu.set_relative_to(widget) - self.taskbarMenu.popup() + self.taskbarMenu.show() + + def hideTaskbarMenu(self, widget, eve): + widget.hide() def setPagerWidget(self): pager = wnck.Pager() @@ -100,11 +100,13 @@ class TaskbarSignals: self.SCREEN = screen self.SCREEN.force_update() # (Re)populate screen windows list self.refreashTaskbar() + def windowOpened(self, screen, window): self.SCREEN.force_update() # (Re)populate screen windows list btn = self.createWinBttn(window) self.setupSignals(btn, window) self.taskBarButtons.add(btn) + def windowClosed(self, screen, window): self.clearChildren(self.taskBarButtons) self.SCREEN.force_update() # (Re)populate screen windows list diff --git a/src/Pytop/utils/FileHandler.py b/src/Pytop/utils/FileHandler.py index 2376792..f33d389 100644 --- a/src/Pytop/utils/FileHandler.py +++ b/src/Pytop/utils/FileHandler.py @@ -38,19 +38,19 @@ class FileHandler: def openFile(self, file): print("Opening: " + file) if file.lower().endswith(self.vids): - subprocess.Popen([self.MEDIAPLAYER, self.MPV_WH, file], stdout=subprocess.PIPE) + subprocess.Popen([self.MEDIAPLAYER, self.MPV_WH, file], stdout=subprocess.PIPE, close_fds=True) elif file.lower().endswith(self.music): - subprocess.Popen([self.MUSICPLAYER, file], stdout=subprocess.PIPE) + subprocess.Popen([self.MUSICPLAYER, file], stdout=subprocess.PIPE, close_fds=True) elif file.lower().endswith(self.images): - subprocess.Popen([self.IMGVIEWER, file], stdout=subprocess.PIPE) + subprocess.Popen([self.IMGVIEWER, file], stdout=subprocess.PIPE, close_fds=True) elif file.lower().endswith(self.txt): - subprocess.Popen([self.TEXTVIEWER, file], stdout=subprocess.PIPE) + subprocess.Popen([self.TEXTVIEWER, file], stdout=subprocess.PIPE, close_fds=True) elif file.lower().endswith(self.pdf): - subprocess.Popen([self.PDFVIEWER, file], stdout=subprocess.PIPE) + subprocess.Popen([self.PDFVIEWER, file], stdout=subprocess.PIPE, close_fds=True) elif file.lower().endswith(self.office): - subprocess.Popen([self.OFFICEPROG, file], stdout=subprocess.PIPE) + subprocess.Popen([self.OFFICEPROG, file], stdout=subprocess.PIPE, close_fds=True) else: - subprocess.Popen(['xdg-open', file], stdout=subprocess.PIPE) + subprocess.Popen(['xdg-open', file], stdout=subprocess.PIPE, close_fds=True) def create(self, name, type): diff --git a/src/Pytop/widgets/Grid.py b/src/Pytop/widgets/Grid.py index 096e2de..cc55573 100644 --- a/src/Pytop/widgets/Grid.py +++ b/src/Pytop/widgets/Grid.py @@ -40,7 +40,6 @@ class Grid: self.imagesFilter = settings.returnImagesFilter() self.iconFactory = Icon(settings) self.helperThread = None # Helper thread object - self.toWorkPool = [] # Thread fills pool and gtk empties it self.selectedFiles = [] self.currentPath = "" @@ -52,6 +51,7 @@ class Grid: # @threaded def setNewDirectory(self, path): + self.store.clear() self.currentPath = path dirPaths = ['.', '..'] vids = [] @@ -86,38 +86,17 @@ class Grid: files.sort() files = dirPaths + vids + images + desktop + files - self.store.clear() + self.generateGridIcons(path, files) - # Run helper thread... - self.helperThread = threading.Thread(target=self.generateGridIcons, args=(path, files)) - self.helperThread.daemon = True # Set this thread as a Daemon Thread - self.helperThread.start() - # self.generateGridIcons(path, files) - glib.idle_add(self.addToGrid, (files,)) # NOTE: This must stay in the main thread b/c - # gtk isn't thread safe/aware. - # @threaded + @threaded def generateGridIcons(self, dirPath, files): for file in files: - image = self.iconFactory.createIcon(dirPath, file) - self.toWorkPool.append([image, file]) + image = self.iconFactory.createIcon(dirPath, file).get_pixbuf() + glib.idle_add(self.addToGrid, (image, file,)) - - # NOTE: If nothing else is updating, this function gets called immediatly when return is True. - # Returning False ends checks and "continues normal flow" - def addToGrid(self, args): - files = args[0] - - if len(self.toWorkPool) > 0: - for dataSet in self.toWorkPool: - self.store.append([dataSet[0].get_pixbuf(), dataSet[1]]) - - self.toWorkPool.clear() - - if len(self.store) == len(files): # Processed all files - return False - else: # Check again when idle - return True + def addToGrid(self, dataSet): + self.store.append([dataSet[0], dataSet[1]]) def iconDblLeftClick(self, widget, item): try: @@ -187,7 +166,7 @@ class Grid: def returnSelectedFiles(self): # NOTE: Just returning selectedFiles looks like it returns a "pointer" - # to the children. This mean we lose the list if any left click occures + # to the children. This means we lose the list if any left click occures # in this class. files = [] for file in self.selectedFiles: @@ -195,4 +174,5 @@ class Grid: return files def returnCurrentPath(self): - return self.currentPath + currentPath = self.currentPath + return currentPath diff --git a/src/Pytop/widgets/Icon.py b/src/Pytop/widgets/Icon.py index b589615..75dbf11 100644 --- a/src/Pytop/widgets/Icon.py +++ b/src/Pytop/widgets/Icon.py @@ -36,10 +36,9 @@ class Icon: fullPath = dir + "/" + file return self.getIconImage(file, fullPath) - def getIconImage(self, file, fullPath): try: - thumbnl = None + thumbnl = None # Video thumbnail if file.lower().endswith(self.vidsList): @@ -49,22 +48,22 @@ class Icon: if isfile(hashImgPth) == False: self.generateVideoThumbnail(fullPath, hashImgPth) - thumbnl = self.createScaledImage(hashImgPth, self.viIconWH) + thumbnl = self.createScaledImage(hashImgPth, self.viIconWH) # Image Icon elif file.lower().endswith(self.imagesList): - thumbnl = self.createScaledImage(fullPath, self.viIconWH) + thumbnl = self.createScaledImage(fullPath, self.viIconWH) # .desktop file parsing elif fullPath.lower().endswith( ('.desktop',) ): - thumbnl = self.parseDesktopFiles(fullPath) + thumbnl = self.parseDesktopFiles(fullPath) # System icons else: - thumbnl = self.getSystemThumbnail(fullPath, self.systemIconImageWH[0]) + 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) + 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") + thumbnl = gtk.Image.new_from_file("resources/icons/bin.png") return thumbnl except Exception as e: