def __init__(self,master): AbstractBeeDockWindow.__init__(self,master) self.setAttribute(qtcore.Qt.WA_DeleteOnClose,False) self.ui=Ui_BeePaletteDock() self.ui.setupUi(self) self.show() self.ui.FGSwatch=FGSwatch(master,replacingwidget=self.ui.FGSwatch) self.setFGColor(qtgui.QColor(0,0,0)) self.ui.BGSwatch=BGSwatch(master,replacingwidget=self.ui.BGSwatch) self.setBGColor(qtgui.QColor(255,255,255)) # read in pallette file palfilename=os.path.join("config","default.pal") palfile=qtcore.QFile(palfilename) if palfile.exists(): palfile.open(qtcore.QIODevice.ReadOnly) reader=PaletteParser(palfile) colors=reader.getColors() swatchsize=reader.swatchsize else: colors=[] self.setColors(colors,swatchsize)
def loadPalette(self,filename): infile=qtcore.QFile(filename) if infile.open(qtcore.QIODevice.ReadOnly): reader=PaletteParser(infile) colors=reader.getColors() self.ui.swatch_frame.setupSwatches(colors)