Merge pull request #10 from aglebov/display-percentage

Display percentage
This commit is contained in:
Correl Roush 2013-04-11 18:33:50 -07:00
commit 8dcc73add0
3 changed files with 28 additions and 5 deletions

View file

@ -91,7 +91,7 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
l.setLabel2(statusline) l.setLabel2(statusline)
l.setProperty('TorrentStatusIcon', statusicons[torrent.status]) l.setProperty('TorrentStatusIcon', statusicons[torrent.status])
l.setProperty('TorrentID', str(i)) l.setProperty('TorrentID', str(i))
l.setProperty('TorrentProgress', "%.2f" % torrent.progress) l.setProperty('TorrentProgress', "%3d%%" % torrent.progress)
l.setInfo('torrent', torrent.fields) l.setInfo('torrent', torrent.fields)
l.setInfo('video', {'episode': int(torrent.progress)}) l.setInfo('video', {'episode': int(torrent.progress)})
@ -216,10 +216,11 @@ class TorrentInfoGUI(xbmcgui.WindowXMLDialog):
list = self.getControl(220) list = self.getControl(220)
labelName = self.getControl(1) labelName = self.getControl(1)
labelStatus = self.getControl(2) labelStatus = self.getControl(2)
labelProgress = self.getControl(11)
torrent = self.transmission.info()[self.torrent_id] torrent = self.transmission.info()[self.torrent_id]
files = self.transmission.get_files(self.torrent_id)[self.torrent_id] files = self.transmission.get_files(self.torrent_id)[self.torrent_id]
statusline = "[%(status)s] %(down)s down (%(pct).2f%%), %(up)s up (Ratio: %(ratio).2f)" % \ statusline = "[%(status)s] %(down)s down, %(up)s up (Ratio: %(ratio).2f)" % \
{'down': Bytes.format(torrent.downloadedEver), 'pct': torrent.progress, \ {'down': Bytes.format(torrent.downloadedEver), 'pct': torrent.progress, \
'up': Bytes.format(torrent.uploadedEver), 'ratio': torrent.ratio, \ 'up': Bytes.format(torrent.uploadedEver), 'ratio': torrent.ratio, \
'status': torrent.status} 'status': torrent.status}
@ -229,6 +230,7 @@ class TorrentInfoGUI(xbmcgui.WindowXMLDialog):
labelName.setLabel(torrent.name) labelName.setLabel(torrent.name)
labelStatus.setLabel(statusline) labelStatus.setLabel(statusline)
labelProgress.setLabel('%3d%%' % (torrent.progress))
pbar.setPercent(torrent.progress) pbar.setPercent(torrent.progress)
for i, file in files.iteritems(): for i, file in files.iteritems():

View file

@ -63,10 +63,17 @@
<description>Torrent progress</description> <description>Torrent progress</description>
<posx>20</posx> <posx>20</posx>
<posy>70</posy> <posy>70</posy>
<width>890</width> <width>830</width>
<height>30</height> <height>30</height>
<visible>true</visible> <visible>true</visible>
</control> </control>
<control type="label" id="11">
<posx>855</posx>
<posy>69</posy>
<width>70</width>
<height>30</height>
<label></label>
</control>
</control> </control>
<control type="list" id="220"> <control type="list" id="220">
<description>File list</description> <description>File list</description>

View file

@ -215,10 +215,17 @@
<control type="progress"> <control type="progress">
<posx>90</posx> <posx>90</posx>
<posy>40</posy> <posy>40</posy>
<width>700</width> <width>640</width>
<height>20</height> <height>20</height>
<info>ListItem.Property(TorrentProgress)</info> <info>ListItem.Property(TorrentProgress)</info>
</control> </control>
<control type="label">
<posx>735</posx>
<posy>33</posy>
<width>60</width>
<height>20</height>
<label>$INFO[ListItem.Property(TorrentProgress)]</label>
</control>
</itemlayout> </itemlayout>
<focusedlayout width="560" height="70"> <focusedlayout width="560" height="70">
<control type="image"> <control type="image">
@ -255,10 +262,17 @@
<control type="progress"> <control type="progress">
<posx>90</posx> <posx>90</posx>
<posy>40</posy> <posy>40</posy>
<width>700</width> <width>640</width>
<height>20</height> <height>20</height>
<info>ListItem.Property(TorrentProgress)</info> <info>ListItem.Property(TorrentProgress)</info>
</control> </control>
<control type="label">
<posx>735</posx>
<posy>33</posy>
<width>60</width>
<height>20</height>
<label>$INFO[ListItem.Property(TorrentProgress)]</label>
</control>
</focusedlayout> </focusedlayout>
</control> </control>
</controls> </controls>