Skip to content

Commit

Permalink
added export settings for cmdline
Browse files Browse the repository at this point in the history
  • Loading branch information
beckf committed Dec 2, 2022
1 parent e761076 commit cb48add
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 31 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.51
1.52
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import logging
import traceback
import update
import json

# Set Scaling for High Resolution Displays
if hasattr(Qt, 'AA_EnableHighDpiScaling'):
Expand Down Expand Up @@ -155,6 +156,7 @@ def __init__(self):

# Settings Buttons
self.ui.btn_SaveSettings.clicked.connect(self.save_settings_button)
self.ui.btn_ExportSettings.clicked.connect(self.export_settings)

# Export Tab
self.ui.chk_ClearCharges.setChecked(False)
Expand Down Expand Up @@ -413,7 +415,7 @@ def create_update_customer(self):
elif 'first_nick_name' in i:
vc_formatted['Customer']['firstName'] = i['first_nick_name']

# Did we find a record in lighspeed to sync to?
# Did we find a record in lightspeed to sync to?
if check_current:

# Create two dictionaries one for VC and the other for LS
Expand Down Expand Up @@ -1190,6 +1192,11 @@ def reveal_hidden(self):
self.ui.txt_VCUser.setEchoMode(QLineEdit.Normal)
self.ui.txt_VCPass.setEchoMode(QLineEdit.Normal)

def export_settings(self):
export_dir = QFileDialog.getExistingDirectory(self, 'Select directory to save settings to.')
with open(export_dir + "/config.json", "w") as outfile:
json.dump(self.c, outfile, indent=4)


if __name__ == '__main__':
app = QApplication(sys.argv)
Expand Down
21 changes: 17 additions & 4 deletions mainwindow.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'qt-lightspeed-pos-vc-connector\mainwindow.ui'
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
Expand Down Expand Up @@ -157,7 +157,6 @@ def setupUi(self, MainWindow):
self.label_15 = QtWidgets.QLabel(self.gridLayoutWidget_6)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_15.setFont(font)
self.label_15.setObjectName("label_15")
self.gridLayout_6.addWidget(self.label_15, 0, 0, 1, 1)
Expand Down Expand Up @@ -440,6 +439,9 @@ def setupUi(self, MainWindow):
self.chk_DebugExport.setText("")
self.chk_DebugExport.setObjectName("chk_DebugExport")
self.gridLayout.addWidget(self.chk_DebugExport, 8, 1, 1, 1)
self.btn_ExportSettings = QtWidgets.QPushButton(self.gridLayoutWidget)
self.btn_ExportSettings.setObjectName("btn_ExportSettings")
self.gridLayout.addWidget(self.btn_ExportSettings, 9, 0, 1, 1)
self.tabs.addTab(self.tab_Settings, "")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
Expand Down Expand Up @@ -526,7 +528,7 @@ def setupUi(self, MainWindow):
self.statusBar.setObjectName("statusBar")
MainWindow.setStatusBar(self.statusBar)
self.menuBar = QtWidgets.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 663, 21))
self.menuBar.setGeometry(QtCore.QRect(0, 0, 663, 24))
self.menuBar.setObjectName("menuBar")
self.menuFile = QtWidgets.QMenu(self.menuBar)
self.menuFile.setObjectName("menuFile")
Expand All @@ -537,7 +539,7 @@ def setupUi(self, MainWindow):
self.menuBar.addAction(self.menuFile.menuAction())

self.retranslateUi(MainWindow)
self.tabs.setCurrentIndex(0)
self.tabs.setCurrentIndex(4)
QtCore.QMetaObject.connectSlotsByName(MainWindow)

def retranslateUi(self, MainWindow):
Expand Down Expand Up @@ -621,6 +623,7 @@ def retranslateUi(self, MainWindow):
self.label_8.setText(_translate("MainWindow", "VC Password"))
self.label_9.setText(_translate("MainWindow", "VC API URL"))
self.label_36.setText(_translate("MainWindow", "Enable Debugging"))
self.btn_ExportSettings.setText(_translate("MainWindow", "Export Settings"))
self.tabs.setTabText(self.tabs.indexOf(self.tab_Settings), _translate("MainWindow", "Settings"))
self.label_18.setText(_translate("MainWindow", "Enter New Password (10 characters min)"))
self.btn_ChangeEncPassword.setText(_translate("MainWindow", "Change Password"))
Expand All @@ -636,3 +639,13 @@ def retranslateUi(self, MainWindow):
self.btn_OpenLog.setText(_translate("MainWindow", "Open Log"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.actionQuit.setText(_translate("MainWindow", "Quit"))


if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())
12 changes: 9 additions & 3 deletions qt-lightspeed-pos-vc-connector/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ max-height: 16px;
<string notr="true"/>
</property>
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<property name="usesScrollButtons">
<bool>false</bool>
Expand Down Expand Up @@ -327,7 +327,6 @@ max-height: 16px;
<widget class="QLabel" name="label_15">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
Expand Down Expand Up @@ -928,6 +927,13 @@ max-height: 16px;
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QPushButton" name="btn_ExportSettings">
<property name="text">
<string>Export Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down Expand Up @@ -1143,7 +1149,7 @@ max-height: 16px;
<x>0</x>
<y>0</y>
<width>663</width>
<height>21</height>
<height>24</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtDesignStudio 2.1.0, 2021-08-07T12:04:01. -->
<!-- Written by QtDesignStudio 3.8.0, 2022-12-02T10:19:13. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{0038c54a-14a0-4324-86c6-60d4afdf2f20}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
<value type="qlonglong">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
Expand All @@ -28,7 +28,7 @@
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
Expand Down Expand Up @@ -63,9 +63,9 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8994bd34-5ed9-4c45-8c0a-94c8f33eca4a}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\fbeck\PycharmProjects\lightspeed-vc-connector\build-qt-lightspeed-pos-vc-connector-Desktop-Debug</value>
Expand All @@ -81,7 +81,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
Expand All @@ -92,14 +92,15 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
Expand All @@ -119,7 +120,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
Expand All @@ -130,14 +131,15 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
Expand All @@ -159,7 +161,7 @@
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
Expand All @@ -170,25 +172,26 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
Expand All @@ -198,12 +201,8 @@
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
Expand All @@ -215,12 +214,12 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
<value type="qlonglong">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cryptography==3.4.7
future==0.18.2
idna==3.2
Jinja2==3.0.1
lightspeed-api==0.3
lightspeed-api>=0.3
macholib==1.14
MarkupSafe==2.0.1
modulegraph==0.18
Expand Down

0 comments on commit cb48add

Please sign in to comment.