2014-03-21, 15:08
Hi,
for my addon XBMC File Cleaner I am currently writing a log viewer that is activated through the addon's settings. In the Artwork Downloader addon I have found something very similar, which I've tailored to my needs. I do however have one issue with the alignment of the text. I'm logging the filenames of any files that get cleaned up and these filenames can be quite long. When using scene names with XBMC, filenames tend to have periods instead of spaces, causing the (default?) justification alignment to mess up the text.
I use the method below in order to set the text in the TextBoxControl. I looked in the documentation but cannot find methods named "setAlign()" or "setProperty('align', 'left')". As you can see in the attached screenshots, alignment is definitely needed. I added some long lines from the XBMC logfile to better show the issue.
Since I know very little about skinning, I don't know how to align the text differently. I noticed from the log files that DialogTextViewer.xml is loaded once the window is activated. I then tried modifying it as below, but it appears to be skin-dependent.
Could someone please help me find a universal way to left-align the text in this particular TextBox only? I don't want to mess up other people's skins just to print one simple log file nicely. On the other hand, if I could tell XBMC to allow wrapping on other characters like dashes, semicolons, colons, periods or comma's that would also be a big help.
for my addon XBMC File Cleaner I am currently writing a log viewer that is activated through the addon's settings. In the Artwork Downloader addon I have found something very similar, which I've tailored to my needs. I do however have one issue with the alignment of the text. I'm logging the filenames of any files that get cleaned up and these filenames can be quite long. When using scene names with XBMC, filenames tend to have periods instead of spaces, causing the (default?) justification alignment to mess up the text.
I use the method below in order to set the text in the TextBoxControl. I looked in the documentation but cannot find methods named "setAlign()" or "setProperty('align', 'left')". As you can see in the attached screenshots, alignment is definitely needed. I added some long lines from the XBMC logfile to better show the issue.
PHP Code:
__title__ = "XBMC File Cleaner"
__logfile__ = "/abs/path/to/cleaner.log"
self.CONTROL_LABEL = 1
self.CONTROL_TEXTBOX = 5
def populate_window(self):
heading = "Cleaning log"
try:
f = open(__logfile__)
except (IOError, OSError) as error:
xbmc.log("%s: %s" % (__title__, error), xbmc.LOGERROR)
else:
self.window.getControl(self.CONTROL_LABEL).setLabel("%s - %s" % (heading, __title__,))
self.window.getControl(self.CONTROL_TEXTBOX).setText(f.read())
f.close()
Since I know very little about skinning, I don't know how to align the text differently. I noticed from the log files that DialogTextViewer.xml is loaded once the window is activated. I then tried modifying it as below, but it appears to be skin-dependent.
PHP Code:
<control type="textbox" id="5">
<posx>432</posx>
<posy>180</posy>
<width>1344</width>
<height>789</height>
<label>-</label>
<align>left</align> <!-- Not in Aeon Nox 4. Added for testing -->
<font>Font_Reg20</font>
<shadowcolor>black</shadowcolor>
<pagecontrol>61</pagecontrol>
</control>
Could someone please help me find a universal way to left-align the text in this particular TextBox only? I don't want to mess up other people's skins just to print one simple log file nicely. On the other hand, if I could tell XBMC to allow wrapping on other characters like dashes, semicolons, colons, periods or comma's that would also be a big help.
watch gallery