Skip to content

Commit

Permalink
add extented color choice
Browse files Browse the repository at this point in the history
  • Loading branch information
LJoyL committed Apr 13, 2018
1 parent 0c6b687 commit a07e579
Show file tree
Hide file tree
Showing 6 changed files with 7,052 additions and 7,027 deletions.
13 changes: 11 additions & 2 deletions src/forms/alg_gfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

translate = QCoreApplication.translate


class AlgoGFuncStmt(QDialog):
def __init__(self, parent, origcode=("x", "cos(x)", "", "", "0.1", '"red"')):
super().__init__(parent)
Expand All @@ -32,10 +31,11 @@ def __init__(self, parent, origcode=("x", "cos(x)", "", "", "0.1", '"red"')):
self.ui.btnCodeStart.clicked.connect(lambda: self.click(self.ui.txtStart))
self.ui.btnCodeEnd.clicked.connect(lambda: self.click(self.ui.txtEnd))
self.ui.btnCodeStep.clicked.connect(lambda: self.click(self.ui.txtStep))
self.ui.btnCodeColor.clicked.connect(lambda: self.click(self.ui.txtColor))
self.ui.btnCodeColor.clicked.connect(self.change_color)

center_widget(self, parent)


def done(self, res):
if res == QDialog.Accepted:
name = self.ui.txtVariable.text()
Expand Down Expand Up @@ -94,10 +94,19 @@ def done(self, res):

super(AlgoGFuncStmt, self).done(res)


def click(self, wgt):
dlg = InlineCodeDialog(self, wgt.text())
if dlg.run():
wgt.setText(dlg.value())


def change_color(self, _):
dlg = QColorDialog(self)

if dlg.exec_():
self.ui.txtColor.setText('"%s"' % dlg.currentColor().name())


def run(self):
return self.exec_() == QDialog.Accepted and self.ok
10 changes: 9 additions & 1 deletion src/forms/alg_gline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, parent, origcode=("", "", "", "", '"red"')):
self.ui.btnCodeStartY.clicked.connect(lambda: self.click(self.ui.txtStartY))
self.ui.btnCodeEndX.clicked.connect(lambda: self.click(self.ui.txtEndX))
self.ui.btnCodeEndY.clicked.connect(lambda: self.click(self.ui.txtEndY))
self.ui.btnCodeColor.clicked.connect(lambda: self.click(self.ui.txtColor))
self.ui.btnCodeColor.clicked.connect(self.change_color)

center_widget(self, parent)

Expand Down Expand Up @@ -79,5 +79,13 @@ def click(self, wgt):
if dlg.run():
wgt.setText(dlg.value())


def change_color(self, _):
dlg = QColorDialog(self)

if dlg.exec_():
self.ui.txtColor.setText('"%s"' % dlg.currentColor().name())


def run(self):
return self.exec_() == QDialog.Accepted and self.ok
10 changes: 9 additions & 1 deletion src/forms/alg_gpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, parent, origcode=("", "", '"red"')):

self.ui.btnCodeX.clicked.connect(lambda: self.click(self.ui.txtX))
self.ui.btnCodeY.clicked.connect(lambda: self.click(self.ui.txtY))
self.ui.btnCodeColor.clicked.connect(lambda: self.click(self.ui.txtColor))
self.ui.btnCodeColor.clicked.connect(self.change_color)

center_widget(self, parent)

Expand Down Expand Up @@ -61,5 +61,13 @@ def click(self, wgt):
if dlg.run():
wgt.setText(dlg.value())


def change_color(self, _):
dlg = QColorDialog(self)

if dlg.exec_():
self.ui.txtColor.setText('"%s"' % dlg.currentColor().name())


def run(self):
return self.exec_() == QDialog.Accepted and self.ok
Loading

0 comments on commit a07e579

Please sign in to comment.