What you see below is my situation
index.py
...
def hourSplitted(self):
self.splitlhour = SplitApp()
...
monthly_report.py
class SplitApp(QMainWindow):
def __init__(self):
QMainWindow.__init__(self).
self.setupUi(self, year = False, month = False)
def setupUi(self, MainWindow, year, month):
if (not year):
year = strftime(“%Y”)
month = strftime(“%-m”)
else:
year = year
month = month
def dataSelect(self, MainWindow):
m_month = self.comboMonth.currentText()
year = self.comboYear.currentText()
month = Functions.convert_month_number[m_month]
self.setupUi(self, checkInput, year,month)
if __name__ == “__main__”:
app = QApplication(sys.argv)
inputpars = sys.argv
inputpars = ['2024', '04']
year = inputpars[0]
month = inputpars[1]
window = SplitApp()
app.exec_()
If SplitApp is called from index.py
or from dataSelect
everything works correctly.
If it is executed as a single script year
and month
are (rightly) the current ones.
I have tried various solutions by putting inputpars
in init()
or with a check in setupUi
. It works from local but not when called from index.py