Skip to content

Commit d288aed

Browse files
committed
Indicator window is now in the middle of the screen.
1 parent fe66b69 commit d288aed

File tree

4 files changed

+57
-28
lines changed

4 files changed

+57
-28
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Form implementation generated from reading ui file 'c:\perso\trading\anaconda3\backtrader-ichimoku\ui\indicatorParameters.ui'
4+
#
5+
# Created by: PyQt5 UI code generator 5.15.5
6+
#
7+
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
8+
# run again. Do not edit this file unless you know what you are doing.
9+
10+
11+
from PyQt5 import QtCore, QtGui, QtWidgets
12+
13+
14+
class Ui_Dialog(object):
15+
def setupUi(self, Dialog):
16+
Dialog.setObjectName("Dialog")
17+
Dialog.resize(400, 300)
18+
self.gridLayout = QtWidgets.QGridLayout(Dialog)
19+
self.gridLayout.setObjectName("gridLayout")
20+
self.title = QtWidgets.QLabel(Dialog)
21+
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
22+
sizePolicy.setHorizontalStretch(0)
23+
sizePolicy.setVerticalStretch(0)
24+
sizePolicy.setHeightForWidth(self.title.sizePolicy().hasHeightForWidth())
25+
self.title.setSizePolicy(sizePolicy)
26+
self.title.setMinimumSize(QtCore.QSize(0, 40))
27+
self.title.setAlignment(QtCore.Qt.AlignCenter)
28+
self.title.setObjectName("title")
29+
self.gridLayout.addWidget(self.title, 0, 0, 1, 1)
30+
self.parameterLayout = QtWidgets.QFormLayout()
31+
self.parameterLayout.setObjectName("parameterLayout")
32+
self.gridLayout.addLayout(self.parameterLayout, 1, 0, 1, 1)
33+
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
34+
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
35+
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
36+
self.buttonBox.setObjectName("buttonBox")
37+
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
38+
39+
self.retranslateUi(Dialog)
40+
self.buttonBox.accepted.connect(Dialog.accept)
41+
self.buttonBox.rejected.connect(Dialog.reject)
42+
QtCore.QMetaObject.connectSlotsByName(Dialog)
43+
44+
def retranslateUi(self, Dialog):
45+
_translate = QtCore.QCoreApplication.translate
46+
Dialog.setWindowTitle(_translate("Dialog", "Custom indicator configuration"))
47+
self.title.setText(_translate("Dialog", "Customize indicator"))

indicatorParametersUI.py

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class IndicatorParametersUI(QtWidgets.QDialog):
77
def __init__(self, parent = None):
88
super(IndicatorParametersUI, self).__init__()
99

10-
self.setParent(parent)
10+
#self.setParent(parent)
1111

1212
# It does not finish by a "/"
1313
self.current_dir_path = os.path.dirname(os.path.realpath(__file__))
@@ -17,26 +17,6 @@ def __init__(self, parent = None):
1717
self.title = self.findChild(QtWidgets.QLabel, "title")
1818
self.parameterLayout = self.findChild(QtWidgets.QFormLayout, "parameterLayout")
1919

20-
# Move at the center of the window
21-
#x = int(parent.sizeHint().width() / 2 - self.sizeHint().width())
22-
#y = int(parent.sizeHint().height() / 2 - self.sizeHint().height())
23-
24-
#self.move( x, y )
25-
pw = parent.sizeHint().width()
26-
ph = parent.sizeHint().height()
27-
28-
px = parent.x()
29-
py = parent.y()
30-
31-
myH = self.height()
32-
mySzH=self.sizeHint().height()
33-
34-
self.move( parent.sizeHint().width() - (self.sizeHint().width() / 2), (parent.sizeHint().height() / 2) - (self.sizeHint().height() / 2))
35-
36-
self.layout().setSizeConstraint( QtWidgets.QLayout.SetFixedSize )
37-
38-
self.setStyleSheet( "background-color: #455364" )
39-
4020
pass
4121

4222
def setTitle(self, title):

ui/indicatorParameters.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
14-
<string>Dialog</string>
14+
<string>Custom indicator configuration</string>
1515
</property>
1616
<layout class="QGridLayout" name="gridLayout">
1717
<item row="0" column="0">
@@ -29,7 +29,7 @@
2929
</size>
3030
</property>
3131
<property name="text">
32-
<string>Indicator</string>
32+
<string>Customize indicator</string>
3333
</property>
3434
<property name="alignment">
3535
<set>Qt::AlignCenter</set>

userInterface.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def resetChart(self):
652652
def addSma(self):
653653

654654
# Show indicator parameter dialog
655-
paramDialog = indicatorParametersUI.IndicatorParametersUI(self.win)
655+
paramDialog = indicatorParametersUI.IndicatorParametersUI()
656656
paramDialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
657657
paramDialog.setTitle("SMA Indicator parameters")
658658
paramDialog.addParameter("SMA Period", 14)
@@ -672,7 +672,9 @@ def addSma(self):
672672
def addEma(self):
673673

674674
# Show indicator parameter dialog
675-
paramDialog = indicatorParametersUI.IndicatorParametersUI(self.win)
675+
676+
677+
paramDialog = indicatorParametersUI.IndicatorParametersUI()
676678
paramDialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
677679
paramDialog.setTitle("EMA Indicator parameters")
678680
paramDialog.addParameter("EMA Period", 9)
@@ -693,7 +695,7 @@ def toogleRsi(self):
693695

694696
if self.RsiPB.isChecked():
695697
# Show indicator parameter dialog
696-
paramDialog = indicatorParametersUI.IndicatorParametersUI(self.dock_charts[self.current_timeframe])
698+
paramDialog = indicatorParametersUI.IndicatorParametersUI()
697699
paramDialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
698700
paramDialog.setTitle("RSI Indicator parameters")
699701
paramDialog.addParameter("RSI Period", 14)
@@ -719,7 +721,7 @@ def toogleStochastic(self):
719721

720722
if self.StochasticPB.isChecked():
721723
# Show indicator parameter dialog
722-
paramDialog = indicatorParametersUI.IndicatorParametersUI(self.dock_charts[self.current_timeframe])
724+
paramDialog = indicatorParametersUI.IndicatorParametersUI()
723725
paramDialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
724726
paramDialog.setTitle("Stochastic Indicator parameters")
725727
paramDialog.addParameter("Stochastic Period K", 14)
@@ -748,7 +750,7 @@ def toogleStochasticRsi(self):
748750

749751
if self.StochasticRsiPB.isChecked():
750752
# Show indicator parameter dialog
751-
paramDialog = indicatorParametersUI.IndicatorParametersUI(self.dock_charts[self.current_timeframe])
753+
paramDialog = indicatorParametersUI.IndicatorParametersUI()
752754
paramDialog.setWindowFlags(QtCore.Qt.CustomizeWindowHint)
753755
paramDialog.setTitle("Stochastic Indicator parameters")
754756
paramDialog.addParameter("Stochastic Rsi Period K", 14)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy