Changed load setup, added logger class, +more
This commit is contained in:
parent
2f4e480265
commit
88d836ac06
Binary file not shown.
@ -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 $@;
|
|
4
src/Pytop/PyTop.py → src/Pytop/__init__.py
Normal file → Executable file
4
src/Pytop/PyTop.py → src/Pytop/__init__.py
Normal file → Executable file
@ -19,7 +19,7 @@ from signal_classes import CrossClassSignals, GridSignals, TaskbarSignals, DrawS
|
|||||||
|
|
||||||
|
|
||||||
class Main:
|
class Main:
|
||||||
def __init__(self):
|
def __init__(self, args):
|
||||||
setproctitle('Pytop')
|
setproctitle('Pytop')
|
||||||
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
|
||||||
@ -74,4 +74,4 @@ if __name__ == "__main__":
|
|||||||
main = Main()
|
main = Main()
|
||||||
gtk.main()
|
gtk.main()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print( repr(e) )
|
35
src/Pytop/__main__.py
Normal file
35
src/Pytop/__main__.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
|
||||||
|
# Python imports
|
||||||
|
import argparse
|
||||||
|
import pdb # For trace debugging
|
||||||
|
from setproctitle import setproctitle
|
||||||
|
|
||||||
|
# Gtk imports
|
||||||
|
import gi, faulthandler, signal
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk as gtk
|
||||||
|
from gi.repository import GLib
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
from __init__ import Main
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
# pdb.set_trace()
|
||||||
|
setproctitle('Pytop')
|
||||||
|
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGINT, gtk.main_quit)
|
||||||
|
faulthandler.enable() # For better debug info
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
# Add long and short arguments
|
||||||
|
parser.add_argument("--file", "-f", default="default", help="JUST SOME FILE ARG.")
|
||||||
|
|
||||||
|
# Read arguments (If any...)
|
||||||
|
args = parser.parse_args()
|
||||||
|
main = Main(args)
|
||||||
|
gtk.main()
|
||||||
|
except Exception as e:
|
||||||
|
print( repr(e) )
|
@ -7,14 +7,6 @@
|
|||||||
<mime-type>inode/directory</mime-type>
|
<mime-type>inode/directory</mime-type>
|
||||||
</mime-types>
|
</mime-types>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAdjustment" id="brushSizeProp">
|
|
||||||
<property name="lower">1</property>
|
|
||||||
<property name="upper">100</property>
|
|
||||||
<property name="value">1</property>
|
|
||||||
<property name="step_increment">1</property>
|
|
||||||
<property name="page_increment">10</property>
|
|
||||||
<signal name="value-changed" handler="onBrushSizeChange" swapped="no"/>
|
|
||||||
</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>
|
||||||
@ -42,6 +34,26 @@
|
|||||||
<placeholder/>
|
<placeholder/>
|
||||||
</child>
|
</child>
|
||||||
<child type="center">
|
<child type="center">
|
||||||
|
<object class="GtkButtonBox" id="taskBarWorkspacesVer">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="layout_style">start</property>
|
||||||
|
<signal name="button-release-event" handler="showSystemStats" swapped="no"/>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
<child type="center">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
|
</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 class="GtkFileChooserButton" id="selectDirDialog">
|
<object class="GtkFileChooserButton" id="selectDirDialog">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
@ -50,26 +62,11 @@
|
|||||||
<property name="title" translatable="yes">Directory Chooser</property>
|
<property name="title" translatable="yes">Directory Chooser</property>
|
||||||
<signal name="file-set" handler="setNewDirectory" swapped="no"/>
|
<signal name="file-set" handler="setNewDirectory" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkButtonBox" id="taskBarWorkspacesVer">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="layout_style">start</property>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="pack_type">end</property>
|
<property name="pack_type">end</property>
|
||||||
<property name="position">0</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
@ -108,58 +105,6 @@
|
|||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkColorButton" id="brushColorProp">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="receives_default">True</property>
|
|
||||||
<property name="use_alpha">True</property>
|
|
||||||
<property name="rgba">rgb(138,226,52)</property>
|
|
||||||
<signal name="color-set" handler="onColorSet" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkDrawingArea" id="drawArea">
|
|
||||||
<property name="height_request">60</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<signal name="configure-event" handler="onConfigure" swapped="no"/>
|
|
||||||
<signal name="draw" handler="onDraw" swapped="no"/>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkSpinButton">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="adjustment">brushSizeProp</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">False</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">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
@ -265,6 +210,9 @@
|
|||||||
<property name="width_request">126</property>
|
<property name="width_request">126</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
<property name="margin_left">10</property>
|
||||||
|
<property name="margin_right">10</property>
|
||||||
|
<property name="justify">center</property>
|
||||||
<property name="track_visited_links">False</property>
|
<property name="track_visited_links">False</property>
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="scale" value="1.5"/>
|
<attribute name="scale" value="1.5"/>
|
||||||
@ -304,6 +252,68 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="GtkAdjustment" id="brushSizeProp">
|
||||||
|
<property name="lower">1</property>
|
||||||
|
<property name="upper">100</property>
|
||||||
|
<property name="value">1</property>
|
||||||
|
<property name="step_increment">1</property>
|
||||||
|
<property name="page_increment">10</property>
|
||||||
|
<signal name="value-changed" handler="onBrushSizeChange" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<object class="GtkPopover" id="systemStats">
|
||||||
|
<property name="width_request">500</property>
|
||||||
|
<property name="height_request">0</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="relative_to">taskBarWorkspacesVer</property>
|
||||||
|
<property name="position">bottom</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColorButton" id="brushColorProp">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_alpha">True</property>
|
||||||
|
<property name="rgba">rgb(138,226,52)</property>
|
||||||
|
<signal name="color-set" handler="onColorSet" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkDrawingArea" id="drawArea">
|
||||||
|
<property name="height_request">60</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<signal name="configure-event" handler="onConfigure" swapped="no"/>
|
||||||
|
<signal name="draw" handler="onDraw" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkSpinButton">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="adjustment">brushSizeProp</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
<object class="GtkImage" id="createImage">
|
<object class="GtkImage" id="createImage">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
@ -18,8 +18,10 @@ class CrossClassSignals:
|
|||||||
|
|
||||||
# Displays Timer
|
# Displays Timer
|
||||||
def displayclock(self):
|
def displayclock(self):
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
timeStr = now.strftime("%I:%M %p %m/%d/%Y")
|
hms = now.strftime("%I:%M %p")
|
||||||
|
mdy = now.strftime("%m/%d/%Y")
|
||||||
|
timeStr = hms + "\n" + mdy
|
||||||
self.timeLabel.set_label(timeStr)
|
self.timeLabel.set_label(timeStr)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
2
src/Pytop/signal_classes/DrawSignals.py
Normal file → Executable file
2
src/Pytop/signal_classes/DrawSignals.py
Normal file → Executable file
@ -111,7 +111,7 @@ class DrawSignals:
|
|||||||
ah = area.get_allocated_height()
|
ah = area.get_allocated_height()
|
||||||
self.aw = aw
|
self.aw = aw
|
||||||
self.ah = ah
|
self.ah = ah
|
||||||
self.xStep = aw / 200 # For x-axis 60 * 2 per 1 sec steps
|
self.xStep = aw / 200 # For x-axis
|
||||||
self.yStep = ah / 100 # For y-axis %s
|
self.yStep = ah / 100 # For y-axis %s
|
||||||
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, aw, ah)
|
self.surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, aw, ah)
|
||||||
self.brush = cairo.Context(self.surface)
|
self.brush = cairo.Context(self.surface)
|
||||||
|
@ -16,6 +16,13 @@ from gi.repository import GLib
|
|||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MouseButton:
|
||||||
|
LEFT_BUTTON = 1
|
||||||
|
MIDDLE_BUTTON = 2
|
||||||
|
RIGHT_BUTTON = 3
|
||||||
|
|
||||||
|
|
||||||
class TaskbarSignals:
|
class TaskbarSignals:
|
||||||
def __init__(self, settings):
|
def __init__(self, settings):
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
@ -32,7 +39,7 @@ class TaskbarSignals:
|
|||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
timeStr = now.strftime("%m/%d/%Y")
|
timeStr = now.strftime("%m/%d/%Y")
|
||||||
parts = timeStr.split("/")
|
parts = timeStr.split("/")
|
||||||
month = int(parts[0])
|
month = int(parts[0]) - 1
|
||||||
day = int(parts[1])
|
day = int(parts[1])
|
||||||
year = int(parts[2])
|
year = int(parts[2])
|
||||||
calendarWid.select_day(day)
|
calendarWid.select_day(day)
|
||||||
@ -42,6 +49,10 @@ class TaskbarSignals:
|
|||||||
calendarPopup.popdown()
|
calendarPopup.popdown()
|
||||||
|
|
||||||
|
|
||||||
|
def showSystemStats(self, widget, eve):
|
||||||
|
if eve.type == gdk.EventType.BUTTON_RELEASE and eve.button == MouseButton.RIGHT_BUTTON:
|
||||||
|
self.builder.get_object('systemStats').popup()
|
||||||
|
|
||||||
def setPagerWidget(self):
|
def setPagerWidget(self):
|
||||||
pager = wnck.Pager()
|
pager = wnck.Pager()
|
||||||
|
|
||||||
|
55
src/Pytop/utils/Logger.py
Normal file
55
src/Pytop/utils/Logger.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Python imports
|
||||||
|
import os, logging
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
class Logger:
|
||||||
|
def __init__(self):
|
||||||
|
self.USER_HOME = os.path.expanduser("~")
|
||||||
|
|
||||||
|
def get_logger(self, loggerName = "NO_LOGGER_NAME_PASSED", createFile = True):
|
||||||
|
"""
|
||||||
|
Create a new logging object and return it.
|
||||||
|
:note:
|
||||||
|
NOSET # Don't know the actual log level of this... (defaulting or literally none?)
|
||||||
|
Log Levels (From least to most)
|
||||||
|
Type Value
|
||||||
|
CRITICAL 50
|
||||||
|
ERROR 40
|
||||||
|
WARNING 30
|
||||||
|
INFO 20
|
||||||
|
DEBUG 10
|
||||||
|
:param loggerName: Sets the name of the logger object. (Used in log lines)
|
||||||
|
:param createFile: Whether we create a log file or just pump to terminal
|
||||||
|
|
||||||
|
:return: the logging object we created
|
||||||
|
"""
|
||||||
|
|
||||||
|
globalLogLvl = logging.DEBUG # Keep this at highest so that handlers can filter to their desired levels
|
||||||
|
chLogLevel = logging.CRITICAL # Prety musch the only one we change ever
|
||||||
|
fhLogLevel = logging.DEBUG
|
||||||
|
log = logging.getLogger(loggerName)
|
||||||
|
|
||||||
|
# Set our log output styles
|
||||||
|
fFormatter = logging.Formatter('[%(asctime)s] %(pathname)s:%(lineno)d %(levelname)s - %(message)s', '%m-%d %H:%M:%S')
|
||||||
|
cFormatter = logging.Formatter('%(pathname)s:%(lineno)d] %(levelname)s - %(message)s')
|
||||||
|
|
||||||
|
ch = logging.StreamHandler()
|
||||||
|
ch.setLevel(level=chLogLevel)
|
||||||
|
ch.setFormatter(cFormatter)
|
||||||
|
log.addHandler(ch)
|
||||||
|
|
||||||
|
if createFile:
|
||||||
|
folder = self.USER_HOME + ".config/pytop/logs"
|
||||||
|
file = folder + "/application.log"
|
||||||
|
|
||||||
|
if not os.path.exists(folder):
|
||||||
|
os.mkdir(folder)
|
||||||
|
|
||||||
|
fh = logging.FileHandler(file)
|
||||||
|
fh.setLevel(level=fhLogLevel)
|
||||||
|
fh.setFormatter(fFormatter)
|
||||||
|
log.addHandler(fh)
|
||||||
|
|
||||||
|
return log
|
@ -15,6 +15,7 @@ import os, json
|
|||||||
class Settings:
|
class Settings:
|
||||||
def __init__(self, monIndex = 0):
|
def __init__(self, monIndex = 0):
|
||||||
self.builder = None
|
self.builder = None
|
||||||
|
self.SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__)) + "/"
|
||||||
|
|
||||||
# 'Filters'
|
# 'Filters'
|
||||||
self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm',
|
self.office = ('.doc', '.docx', '.xls', '.xlsx', '.xlt', '.xltx', '.xlm',
|
||||||
@ -76,7 +77,7 @@ class Settings:
|
|||||||
|
|
||||||
def attachBuilder(self, builder):
|
def attachBuilder(self, builder):
|
||||||
self.builder = builder
|
self.builder = builder
|
||||||
self.builder.add_from_file("resources/PyTop.glade")
|
self.builder.add_from_file(self.SCRIPT_PTH + "../resources/Main_Window.glade")
|
||||||
|
|
||||||
def createWindow(self):
|
def createWindow(self):
|
||||||
# Get window and connect signals
|
# Get window and connect signals
|
||||||
@ -93,7 +94,7 @@ class Settings:
|
|||||||
|
|
||||||
# bind css file
|
# bind css file
|
||||||
cssProvider = gtk.CssProvider()
|
cssProvider = gtk.CssProvider()
|
||||||
cssProvider.load_from_path('resources/stylesheet.css')
|
cssProvider.load_from_path(self.SCRIPT_PTH + '../resources/stylesheet.css')
|
||||||
screen = gdk.Screen.get_default()
|
screen = gdk.Screen.get_default()
|
||||||
styleContext = gtk.StyleContext()
|
styleContext = gtk.StyleContext()
|
||||||
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
|
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||||
@ -113,6 +114,10 @@ class Settings:
|
|||||||
return monitors
|
return monitors
|
||||||
|
|
||||||
|
|
||||||
|
def returnMonitorsInfo(self):
|
||||||
|
return self.monitors
|
||||||
|
|
||||||
|
|
||||||
def saveSettings(self, startPath):
|
def saveSettings(self, startPath):
|
||||||
data = {}
|
data = {}
|
||||||
data['pytop_settings'] = []
|
data['pytop_settings'] = []
|
||||||
@ -125,10 +130,6 @@ class Settings:
|
|||||||
json.dump(data, outfile)
|
json.dump(data, outfile)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def returnMonitorsInfo(self):
|
|
||||||
return self.monitors
|
|
||||||
|
|
||||||
def returnSettings(self):
|
def returnSettings(self):
|
||||||
returnData = []
|
returnData = []
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
from utils.Dragging import Dragging
|
from utils.Dragging import Dragging
|
||||||
from utils.Settings import Settings
|
from .Logger import Logger
|
||||||
from utils.FileHandler import FileHandler
|
from utils.FileHandler import FileHandler
|
||||||
|
from utils.Settings import Settings
|
||||||
|
@ -48,7 +48,6 @@ class Grid:
|
|||||||
self.grid.connect("button_release_event", self.iconSingleClick, (self.grid,))
|
self.grid.connect("button_release_event", self.iconSingleClick, (self.grid,))
|
||||||
|
|
||||||
def setNewDirectory(self, path):
|
def setNewDirectory(self, path):
|
||||||
self.store.clear()
|
|
||||||
self.currentPath = path
|
self.currentPath = path
|
||||||
dirPaths = ['.', '..']
|
dirPaths = ['.', '..']
|
||||||
vids = []
|
vids = []
|
||||||
@ -109,9 +108,15 @@ class Grid:
|
|||||||
|
|
||||||
@threaded
|
@threaded
|
||||||
def updateGrid(self, model, dirPath, file, i):
|
def updateGrid(self, model, dirPath, file, i):
|
||||||
image = self.iconFactory.createThumbnail(dirPath, file).get_pixbuf()
|
# Sinking errors b/c too lazy to find why we get some invalid tree paths when starting..
|
||||||
iter = model.get_iter_from_string(str(i))
|
# I really should take time to figure it out...buuuutttt....it's non-fatal. (For now.)
|
||||||
glib.idle_add(self.replaceInGrid, (iter, image,))
|
# Images don't seem to always load which is curious...
|
||||||
|
try:
|
||||||
|
image = self.iconFactory.createThumbnail(dirPath, file).get_pixbuf()
|
||||||
|
iter = model.get_iter_from_string(str(i))
|
||||||
|
glib.idle_add(self.replaceInGrid, (iter, image,))
|
||||||
|
except Exception as e:
|
||||||
|
print("widgets/Grid.py sinking errors on updateGrid method...")
|
||||||
|
|
||||||
def addToGrid(self, dataSet):
|
def addToGrid(self, dataSet):
|
||||||
self.store.append([dataSet[0], dataSet[1]])
|
self.store.append([dataSet[0], dataSet[1]])
|
||||||
@ -127,6 +132,7 @@ class Grid:
|
|||||||
fileName = model[item][1]
|
fileName = model[item][1]
|
||||||
dir = self.currentPath
|
dir = self.currentPath
|
||||||
file = dir + "/" + fileName
|
file = dir + "/" + fileName
|
||||||
|
self.store.clear()
|
||||||
|
|
||||||
if fileName == ".":
|
if fileName == ".":
|
||||||
self.setNewDirectory(dir)
|
self.setNewDirectory(dir)
|
||||||
|
@ -58,7 +58,7 @@ class Icon:
|
|||||||
return thumbnl
|
return thumbnl
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Thumbnail generation issue:")
|
print("Thumbnail generation issue:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
return gtk.Image.new_from_file(self.SCRIPT_PTH + "../resources/icons/video.png")
|
return gtk.Image.new_from_file(self.SCRIPT_PTH + "../resources/icons/video.png")
|
||||||
|
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class Icon:
|
|||||||
return thumbnl
|
return thumbnl
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Icon generation issue:")
|
print("Icon generation issue:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
return gtk.Image.new_from_file(self.INTERNAL_ICON_PTH)
|
return gtk.Image.new_from_file(self.INTERNAL_ICON_PTH)
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ class Icon:
|
|||||||
return self.createScaledImage(altIconPath, self.systemIconImageWH)
|
return self.createScaledImage(altIconPath, self.systemIconImageWH)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(".desktop icon generation issue:")
|
print(".desktop icon generation issue:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ class Icon:
|
|||||||
return None
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("system icon generation issue:")
|
print("system icon generation issue:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ class Icon:
|
|||||||
return gtk.Image.new_from_pixbuf(scaledPixBuf)
|
return gtk.Image.new_from_pixbuf(scaledPixBuf)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Image Scaling Issue:")
|
print("Image Scaling Issue:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def generateVideoThumbnail(self, fullPath, hashImgPth):
|
def generateVideoThumbnail(self, fullPath, hashImgPth):
|
||||||
@ -209,4 +209,4 @@ class Icon:
|
|||||||
proc.wait()
|
proc.wait()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Video thumbnail generation issue in thread:")
|
print("Video thumbnail generation issue in thread:")
|
||||||
print(e)
|
print( repr(e) )
|
||||||
|
@ -5,6 +5,6 @@ using namespace std;
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
chdir("/opt/Pytop/");
|
chdir("/opt/Pytop/");
|
||||||
system("python3 PyTop.py");
|
system("python3 .");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user