Skip to content

Commit

Permalink
Merge branch 'stdm-syria' of https://github.com/gltn/stdm into stdm-s…
Browse files Browse the repository at this point in the history
…yria
  • Loading branch information
pgathogo committed Jun 9, 2022
2 parents ad43892 + a146823 commit 1b529a3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 17 deletions.
4 changes: 2 additions & 2 deletions data/configuration/value_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def __init__(self, name, profile):

self.user_editable = False

self.code_column = VarCharColumn('code', self, minimum=0, maximum=5)
self.value_column = VarCharColumn('value', self, minimum=2, maximum=50)
self.code_column = VarCharColumn('code', self, minimum=0, maximum=10)
self.value_column = VarCharColumn('value', self, minimum=2, maximum=100)
self.values = OrderedDict()
self._hash = hashlib

Expand Down
4 changes: 3 additions & 1 deletion settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RegistryConfig,
ENTITY_BROWSER_RECORD_LIMIT,
IMPORT_MAPFILE,
ENUM_COUNTRY,
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- ENUM_COUNTRY,
TRANS_PATH,
MEDIA_URL,
KOBO_USER,
Expand Down Expand Up @@ -102,6 +102,7 @@ def save_import_mapfile(mapfile):
reg_config = RegistryConfig()
reg_config.write({IMPORT_MAPFILE:mapfile})

"""Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- Edit Start
def save_enum_country(country):
reg_config = RegistryConfig()
reg_config.write({ENUM_COUNTRY:country})
Expand All @@ -111,6 +112,7 @@ def get_enum_country():
enum_country_key = reg_config.read([ENUM_COUNTRY])
enum_country = enum_country_key.get(ENUM_COUNTRY, '')
return enum_country
Edit End """

def get_trans_path():
reg_config = RegistryConfig()
Expand Down
17 changes: 16 additions & 1 deletion ui/export_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,23 @@
SIGNAL
)

from stdm.settings import get_primary_mapfile #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
import sqlalchemy

from stdm.utils import *
from stdm.utils.util import getIndex
#Edited By strabzounly 03-may-2022 >- Select Custom Tables (Textual) from stdm.utils.util import getIndex
from stdm.ui.reports import SqlHighlighter
from stdm.data.pg_utils import (
process_report_filter,
table_column_names,
unique_column_values,
pg_tables
)
from stdm.utils.util import ( #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
getIndex, #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
mapfile_section, #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
) #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)

from stdm.data.importexport.writer import OGRWriter

from stdm.data.importexport import (
Expand Down Expand Up @@ -175,13 +181,22 @@ def loadSourceTables(self):
#Load all STDM tables
self.lstSrcTab.clear()
# tables = pg_tables()
"""Edited By strabzounly 03-may-2022 >- Select Custom Tables (Textual) >- Edit Start
tables = profile_user_tables(
self.curr_profile, True, True, sort=True
)
Edit End """
tables = profile_user_tables(self.curr_profile, False, True) #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
primary_mapfile = get_primary_mapfile() #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
dest_tables = mapfile_section(primary_mapfile, 'imports') #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)

for t in tables.keys():
if len(dest_tables) > 0: #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
if t not in dest_tables.values(): continue #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)
tabItem = QListWidgetItem(t,self.lstSrcTab)
tabItem.setIcon(QIcon(":/plugins/stdm/images/icons/table.png"))
self.lstSrcTab.addItem(tabItem)
self.loadColumns("") #Added By strabzounly 03-may-2022 >- Select Custom Tables (Textual)

def setDestFile(self):
#Set the file path to the destination file
Expand Down
2 changes: 1 addition & 1 deletion ui/import_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
get_kobo_user,
get_kobo_pass,
get_save_credit_option,
get_enum_country,
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- get_enum_country,
get_family_photo,
get_sign_photo,
get_house_photo,
Expand Down
18 changes: 12 additions & 6 deletions ui/options_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
save_entity_browser_record_limit,
get_primary_mapfile,
save_import_mapfile,
save_enum_country,
get_enum_country
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- save_enum_country,
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- get_enum_country
)

from stdm.settings.registryconfig import (
Expand Down Expand Up @@ -165,16 +165,20 @@ def init_gui(self):

self.edtMapfile.setText(get_primary_mapfile())

"""Edited By strabzounly 03-may-2022 >- Deleted chk_logging >- Edit Start
# Debug logging
lvl = debug_logging()
if lvl:
self.chk_logging.setCheckState(Qt.Checked)
else:
self.chk_logging.setCheckState(Qt.Unchecked)
Edit End """

"""Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- Edit Start
self.populate_enum_country()
enum_country = get_enum_country()
self.cbCountry.setCurrentIndex(self.cbCountry.findText(enum_country))
Edit End """

def load_profiles(self):
"""
Expand All @@ -186,12 +190,12 @@ def load_profiles(self):
self.cbo_profiles.addItem('')
self.cbo_profiles.addItems(profile_names)

"""Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- Edit Start
def populate_enum_country(self):
"""
"""
self.cbCountry.clear()
self.cbCountry.addItem('Iraq')
self.cbCountry.addItem('Lebanon')
Edit End """

def _load_db_conn_properties(self):
#Load database connection properties from the registry.
Expand Down Expand Up @@ -505,6 +509,7 @@ def _restore_stylesheet(self, textbox):
if not sender is None:
sender.deleteLater()

"""Edited By strabzounly 03-may-2022 >- Deleted chk_logging >- Edit Start
def apply_debug_logging(self):
# Save debug logging
logger = logging.getLogger('stdm')
Expand All @@ -515,6 +520,7 @@ def apply_debug_logging(self):
else:
logger.setLevel(logging.ERROR)
set_debug_logging(False)
Edit End """

def apply_settings(self):
"""
Expand Down Expand Up @@ -543,14 +549,14 @@ def apply_settings(self):
if not self.set_document_output_path():
return False

self.apply_debug_logging()
#Edited By strabzounly 03-may-2022 >- Deleted chk_logging >- self.apply_debug_logging()

# Set Entity browser record limit
save_entity_browser_record_limit(self.edtEntityRecords.value())

save_import_mapfile(self.edtMapfile.text())

save_enum_country(self.cbCountry.currentText())
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- save_enum_country(self.cbCountry.currentText())

msg = self.tr('Settings successfully saved.')
self.notif_bar.insertSuccessNotification(msg)
Expand Down
18 changes: 12 additions & 6 deletions ui/ui_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _translate(context, text, disambig):
class Ui_DlgOptions(object):
def setupUi(self, DlgOptions):
DlgOptions.setObjectName(_fromUtf8("DlgOptions"))
DlgOptions.resize(626, 612)
DlgOptions.resize(626, 525)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
Expand Down Expand Up @@ -123,9 +123,13 @@ def setupUi(self, DlgOptions):
self.label_9 = QtGui.QLabel(self.scrollAreaWidgetContents)
self.label_9.setObjectName(_fromUtf8("label_9"))
self.gridLayout_6.addWidget(self.label_9, 3, 0, 1, 1)
self.cbCountry = QtGui.QComboBox(self.scrollAreaWidgetContents)
self.cbCountry.setObjectName(_fromUtf8("cbCountry"))
self.gridLayout_6.addWidget(self.cbCountry, 3, 1, 1, 1)


"""Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- Edit Start
#self.cbCountry = QtGui.QComboBox(self.scrollAreaWidgetContents)
#self.cbCountry.setObjectName(_fromUtf8("cbCountry"))
#self.gridLayout_6.addWidget(self.cbCountry, 3, 1, 1, 1)
Edit End """
self.gridLayout_5.addLayout(self.gridLayout_6, 7, 0, 1, 5)
self.gridLayout_7 = QtGui.QGridLayout()
self.gridLayout_7.setHorizontalSpacing(6)
Expand All @@ -147,9 +151,11 @@ def setupUi(self, DlgOptions):
self.upgradeButton = QtGui.QPushButton(self.scrollAreaWidgetContents)
self.upgradeButton.setObjectName(_fromUtf8("upgradeButton"))
self.gridLayout_5.addWidget(self.upgradeButton, 10, 1, 1, 1)
"""Edited By strabzounly 03-may-2022 >- Deleted chk_logging >- Edit Start
self.chk_logging = QtGui.QCheckBox(self.scrollAreaWidgetContents)
self.chk_logging.setObjectName(_fromUtf8("chk_logging"))
self.gridLayout_5.addWidget(self.chk_logging, 9, 0, 1, 1)
Edit End """
self.groupBox = QtGui.QGroupBox(self.scrollAreaWidgetContents)
self.groupBox.setObjectName(_fromUtf8("groupBox"))
self.gridLayout_3 = QtGui.QGridLayout(self.groupBox)
Expand Down Expand Up @@ -246,10 +252,10 @@ def retranslateUi(self, DlgOptions):
self.btn_supporting_docs.setToolTip(_translate("DlgOptions", "Choose supporting documents directory", None))
self.btn_supporting_docs.setText(_translate("DlgOptions", "...", None))
self.lblMapFile.setText(_translate("DlgOptions", "Root Import Map File:", None))
self.label_9.setText(_translate("DlgOptions", "Country of Enumeration:", None))
#Edited By strabzounly 03-may-2022 >- Deleted cbCountry >- self.label_9.setText(_translate("DlgOptions", "Country of Enumeration:", None))
self.label.setText(_translate("DlgOptions", "Set current profile", None))
self.upgradeButton.setText(_translate("DlgOptions", "Upgrade", None))
self.chk_logging.setText(_translate("DlgOptions", "Debug logging", None))
#Edited By strabzounly 03-may-2022 >- Deleted chk_logging >- self.chk_logging.setText(_translate("DlgOptions", "Debug logging", None))
self.groupBox.setTitle(_translate("DlgOptions", "Database Properties", None))
self.label_5.setText(_translate("DlgOptions", "<html><head/><body><p><span style=\" font-weight:600;\">Note:</span> Changes to the database connection properties will only take effect upon the next login</p></body></html>", None))
self.label_3.setText(_translate("DlgOptions", "Port", None))
Expand Down

0 comments on commit 1b529a3

Please sign in to comment.