def initGUI(self): self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self.toolbar = QWidget(self) self.toolbar.resize(self.toolbar_width, self.size().height()) self.toolbar.move(self.width - self.toolbar_width, 0) self.toolbar.setStyleSheet(""" .QWidget { background-color: #123;}""") pal = self.palette() pal.setColor(self.backgroundRole(), Qt.white) self.setPalette(pal) self.grid = QGridLayout() self.grid.setSpacing(10) self.toolbar.setLayout(self.grid) self.row = 5 A = sorted([ 'hot', 'viridis', 'plasma', 'inferno', 'flag', 'prism', 'nipy_spectral', 'RdYlBu', 'BuPu', 'YlGnBu', 'ocean', 'gist_earth', 'gist_ncar', 'jet', 'cubehelix', 'rainbow' ]) A.extend(list(map(lambda x: x + '_r', A))) SIZE(self, 0, 3, MaxWidth=25200, MaxHeight=25000) DRAW(self, 2) DEPH(self, 4, 3, MaxDeph=10000) CONSTANT(self, 5, 3, DefaultConst='-0.745+0.115j') BOUNDS(self, 6, 3, DefaultBounds=['-1.5', '1.5', '0']) LUPA(self, 8) FUNCTIONS(self, 9, DefaultF='z*z+c', DefaultG='i+cabs(z)*(deph/10/(i+1))', DefaultH='''int k; for (k=1;k<=deph;k++){ z = F(z,c); if (cabs(z)>5) break; }''') COLORMAP(self, 12, DefaultMap='p2', DefaultColorMaps=A) ANIMATE(self, 13, 3, DefaultSpeed='250', DefaultDelta='c-0.01j') SAVE(self, 15) #PLOT self.CANVAS = PLOT(self) self.CANVAS.move(0, 0) self.i = False self.state = 0 new_F(self.F.text()) new_G(self.G.text()) new_H('\n\t'.join(self.H.toPlainText().split('\n'))) comp_le() self.show()
def recompile(self): if self.g.checkState(): new_G(self.G.text()) comp_le() if self.f.checkState(): new_F(self.F.text()) comp_le() if self.h.checkState(): new_H('\n\t'.join(self.H.toPlainText().split('\n'))) comp_le() return None
def recompile(self): if self.g.checkState(): new_G(self.G.text()) comp_le() if self.f.checkState(): new_F(self.F.text()) comp_le() if self.h.checkState(): self.TYPES["other"] = "\n\t".join( self.other.toPlainText().split('\n')) new_H(self.TYPES[self.H.currentText()]) comp_le() return None
def initGUI(self): self.setWindowTitle(self.title) self.setGeometry(0, 0, self.width, self.height) self.toolbar = QWidget(self) self.toolbar.resize(self.toolbar_width, self.height) self.toolbar.move(self.width - self.toolbar_width, 0) self.toolbar.setStyleSheet(".QWidget {background-color: #123;}") self.palette().setColor(self.backgroundRole(), Qt.white) self.grid = QGridLayout() self.grid.setSpacing(10) self.toolbar.setLayout(self.grid) self.row = 5 COLORS = sorted([ 'hot', 'viridis', 'plasma', 'inferno', 'flag', 'prism', 'nipy_spectral', 'RdYlBu', 'BuPu', 'YlGnBu', 'ocean', 'gist_earth', 'gist_ncar', 'jet', 'cubehelix', 'rainbow' ]) COLORS.extend(list(map(lambda x: x + '_r', COLORS))) self.TYPES = { "Julia": "int k;\n\tfor (k=1;k<=deph;k++){\n\t\tz = F(z,c);\n\t\tif (cabs(z)>5) break;\n\t}", "Mandelbrot": "int k;\n\tfor (k=1;k<=deph;k++){\n\t\tc = F(c,z);\n\t\tif (cabs(c)>5) break;\n\t}\n\tz=c;", "Spider": "int k;\n\tfor (k=1;k<=deph;k++){\n\t\tz = F(z,c);\n\t\tc = z+c/2;\n\t\tif (cabs(z)>5) break;\n\t}", "Spider2": "int k; c=z; \n\tfor (k=1;k<=deph;k++){\n\t\tz = F(z,c);\n\t\tc = z+c/2;\n\t\tif (cabs(z)>5) break;\n\t}", "other": "int k;\n\tfor (k=1;k<=deph;k++){\n\t\tz = F(z,c);\n\t\tif (cabs(z)>5) break;\n\t}" } SIZE(self, 0, 3, MaxWidth=25200, MaxHeight=25000) DRAW(self, 2) DEPH(self, 4, 3, MaxDeph=10000) CONSTANT(self, 5, 3, DefaultConst='-0.745+0.115j') BOUNDS(self, 6, 3, DefaultBounds=['-1.5', '1.5', '0']) ZOOM(self, 8) FUNCTIONS(self, 9, DefaultF="z*z+c", DefaultG="i+cabs(z)*deph/10/(i+1)", DefaultFractalTypes=self.TYPES.keys(), DefaultH="Julia") EDIT(self, 300, 200) COLORMAP(self, 12, DefaultMap='p2', DefaultColorMaps=COLORS) ANIMATE(self, 13, 3, DefaultSpeed='250', DefaultDelta='c-0.01j') SAVE(self, 15) #PLOT self.CANVAS = PLOT(self) self.CANVAS.move(0, 0) self.state = 0 new_F(self.F.text()) new_G(self.G.text()) new_H(self.TYPES[self.H.currentText()]) comp_le() self.show()