mirror of
https://github.com/gryf/wmdocklib.git
synced 2025-12-19 04:20:17 +01:00
Added debug flag to the DockApp class.
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from wmdocklib import helpers
|
from wmdocklib import helpers
|
||||||
@@ -27,6 +29,7 @@ class DockApp:
|
|||||||
self.font = None
|
self.font = None
|
||||||
self.background = None
|
self.background = None
|
||||||
self.patterns = None
|
self.patterns = None
|
||||||
|
self._debug = False
|
||||||
|
|
||||||
def check_for_events(self):
|
def check_for_events(self):
|
||||||
event = helpers.get_event()
|
event = helpers.get_event()
|
||||||
@@ -175,11 +178,15 @@ class DockApp:
|
|||||||
if self.font:
|
if self.font:
|
||||||
xpm += [line + ' ' * (xpmwidth - len(line)) for line in fontdef]
|
xpm += [line + ' ' * (xpmwidth - len(line)) for line in fontdef]
|
||||||
|
|
||||||
with open('/tmp/foo.xpm', 'w') as fobj:
|
if self._debug:
|
||||||
fobj.write('/* XPM */\nstatic char *_x_[] = {\n')
|
fd, fname = tempfile.mkstemp(suffix='.xpm')
|
||||||
for item in xpm:
|
os.close(fd)
|
||||||
fobj.write(f'"{item}"\n')
|
with open(fname, 'w') as fobj:
|
||||||
fobj.write('};\n')
|
fobj.write('/* XPM */\nstatic char *_x_[] = {\n')
|
||||||
|
for item in xpm:
|
||||||
|
fobj.write(f'"{item}"\n')
|
||||||
|
fobj.write('};\n')
|
||||||
|
print(f'Saved XPM file under {fname}.')
|
||||||
|
|
||||||
pywmgeneral.include_pixmap(xpm)
|
pywmgeneral.include_pixmap(xpm)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user