2 Xinloe -- A Python-Based Non-Linear Ogg Editor
3 Copyright (C) 2004 Arc Riley <arc@Xiph.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # We'll import all external modules here
28 from wxPython
.wx
import *
29 from wxPython
.lib
.scrolledpanel
import wxScrolledPanel
31 def geticon(name
, size
=1):
32 sizes
=('16x16','22x22','32x32','48x48')
33 f
= 'icons/%s/%s.png' % (sizes
[size
], name
)
34 if not os
.path
.exists(f
) :
35 f
= 'icons/%s/%s.png' % (sizes
[size
], 'unknown')
36 return wxImage(f
, wxBITMAP_TYPE_PNG
).ConvertToBitmap()
38 def gettext(parent
, string
, size
=1):
39 text
= wxStaticText(parent
, -1, string
)
41 font
.SetPointSize(font
.GetPointSize()+size
)
47 minutes
= (seconds
-( hours
*3600 ))/60
48 seconds
= (seconds
-((hours
*3600)+(minutes
*60)))
50 (str(hours
).zfill(2), str(minutes
).zfill(2), str(seconds
).zfill(2))
52 def ratestr(bytes
, seconds
):
53 if seconds
== 0 : return '0bps'
54 bps
= (bytes
* 8.0) / seconds
56 return '%dgbps' % round(bps
/1073741824,2)
58 return '%dmbps' % round(bps
/1048576,1)
60 return '%dkbps' % round(bps
/1024,0)
61 return '%dbps' % round(bps
,0)
64 if bytes
> 1073741823:
65 return '%dgb' % round(bytes
/1073741824,2)
67 return '%dmb' % round(bytes
/1048576,1)
69 return '%dkb' % round(bytes
/1024,0)
70 return '%db' % round(bytes
,0)