diff --git a/theme/test_theme.py b/theme/test_theme.py index 2b6d9f421..030944e45 100644 --- a/theme/test_theme.py +++ b/theme/test_theme.py @@ -1,6 +1,6 @@ from theme import Theme -import wx import os.path +from PyQt4 import QtGui def test_read_theme(): dir=os.path.split(__file__)[0] # test we can read a theme @@ -10,24 +10,24 @@ def test_read_theme(): assert(t.BackgroundParameter2 == None) assert(t.BackgroundParameter3 == None) assert(t.BackgroundType == 2) - assert(t.FontColor == wx.Colour(255,255,255)) + assert(t.FontColor == QtGui.QColor(255,255,255)) assert(t.FontName == "Tahoma") assert(t.FontProportion == 16) assert(t.HorizontalAlign == 2) assert(t.Name == "openlp.org Packaged Theme") assert(t.Outline == -1) - assert(t.OutlineColor == wx.Colour(255,0,0)) + assert(t.OutlineColor == QtGui.QColor(255,0,0)) assert(t.Shadow == -1) - assert(t.ShadowColor == wx.Colour(0,0,1)) + assert(t.ShadowColor == QtGui.QColor(0,0,1)) assert(t.VerticalAlign == 0) # test we create a "blank" theme correctly t=Theme() print t - assert(t.BackgroundParameter1 == wx.Colour(0,0,0)) + assert(t.BackgroundParameter1 == QtGui.QColor(0,0,0)) assert(t.BackgroundParameter2 == None) assert(t.BackgroundParameter3 == None) assert(t.BackgroundType == 0) - assert(t.FontColor == wx.Colour(255,255,255)) + assert(t.FontColor == QtGui.QColor(255,255,255)) assert(t.FontName == "Arial") assert(t.FontProportion == 30) assert(t.HorizontalAlign == 0) diff --git a/theme/theme.py b/theme/theme.py index 4c0c484ad..e7c7c602f 100644 --- a/theme/theme.py +++ b/theme/theme.py @@ -1,5 +1,12 @@ -from elementtree.ElementTree import ElementTree, XML -import wx +import platform +ver = platform.python_version() +if ver >= '2.5': + from xml.etree.ElementTree import ElementTree, XML +else: + from elementtree import ElementTree, XML + +from PyQt4 import QtGui + DelphiColors={"clRed":0xFF0000, "clBlack":0x000000, "clWhite":0xFFFFFF} @@ -19,7 +26,7 @@ blankstylexml=\ 0 0 0 - + 0 ''' @@ -108,7 +115,7 @@ class Theme: if (element.tag.find("Color") > 0 or (element.tag.find("BackgroundParameter") == 0 and type(val) == type(0))): # convert to a wx.Colour - val= wx.Colour((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF) + val= QtGui.QColor((val>>16) & 0xFF, (val>>8)&0xFF, val&0xFF) # print [val] setattr(self,element.tag, val) @@ -120,5 +127,3 @@ class Theme: s+= "%30s : %s\n" %(k,getattr(self,k)) return s -if __name__=="__main__": - test_theme.test_read_theme()