def province_set_up(province_dict, current_id=6, terrain="plains"): """ Writes to the common/province setup file. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\common\\province_setup\\%(number)s_province_setup.txt" % { 'number': last_file_id } import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) with open(rel_path, "a") as file: file.write(str(current_id) + " = {\n") file.write( " title = c_" + province_dict.get("county").lower().replace(" ", "_") + "\n") file.write(" max_settlements = " + str(len(province_dict.keys()) - 1) + "\n") file.write(" terrain = " + terrain.lower().replace(" ", "_") + "\n}\n") import logging logging.info( "Province-Setup: c_%s", province_dict.get("county").lower().replace(" ", "_"))
def init_landed_titles(): """ Creates the common/landed titles file. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\common\\landed_titles\\%(number)s_landed_titles.txt" % { 'number': last_file_id } import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) open(rel_path, "w") import logging logging.info("Init landed titles %s", rel_path)
def init_province_set_up(): """ Creates the common/province setup file. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\common\\province_setup\\%(number)s_province_setup.txt" % { 'number': last_file_id } import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) open(rel_path, "w") import logging logging.info("Init province-setup %s", rel_path)
def write(fileName, startID=6, culture="Norse", religion="Catholic", is_tribal=False, terrain="Plains", rgb_basis=(255, 102, 0), flag_removal=False, templeDist=0): """ The actual script compiling all the other stuff. """ import logging # Reset empty to default from _workbench import configs config_obj = configs.configs() if culture in '': culture = config_obj.read_config('Last_Setup', 'culture') if religion in '': religion = config_obj.read_config('Last_Setup', 'religion') if terrain in '': terrain = config_obj.read_config('Last_Setup', 'terrain') province.read.flags.shuffle_flag_list() province.write.common.init_province_set_up() province.write.common.init_landed_titles() province.write.loc.init_loc() spreadsheet = open(fileName, "r") current_id = startID provinces = spreadsheet.readlines() for x in provinces: province_dict = province.read.dictionary_creation(x) logging.info("Started with %s", x[:-2]) province.write.history.history_province(province_dict, current_id, culture.lower(), religion.lower(), is_tribal, terrain.lower(), templeDist) province.write.history.history_titles(province_dict) province.write.common.province_set_up(province_dict, current_id, terrain) province.write.common.landed_titles(province_dict, rgb_basis) province.write.loc.locs(province_dict, current_id) province.write.flags.assign_flag(province_dict, flag_removal) current_id += 1 logging.info("Finished with %s", province_dict) logging.info('-- Finished Writing -- ')
def locs(province_dict, current_id): """ Populate the localisation file. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\localisation\\%(number)s_province_setup.csv" % { 'number': last_file_id } import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) with open(rel_path, "a") as file: county_name = province_dict.get("county") county_name_adj = province.write.loc.adjective(county_name) file.write("PROV" + str(current_id) + ";" + county_name + ";" + county_name + ";" + county_name + ";;" + county_name + ";;;;;;;;;\n") file.write("c_" + county_name.lower().replace(" ", "_") + ";" + county_name + ";" + county_name + ";" + county_name + ";;" + county_name + ";;;;;;;;;\n") file.write("c_" + county_name.lower().replace(" ", "_") + "_adj;" + county_name_adj + ";" + county_name_adj + ";" + county_name_adj + ";;" + county_name_adj + ";;;;;;;;;\n") loc_lines_added = 3 num = 1 for each in province_dict: province_dict_instance = province_dict.get("barony_" + str(num)) if province_dict_instance is None: break file.write( "b_" + province_dict_instance.lower().replace(" ", "_") + ";" + province_dict_instance + ";" + province_dict_instance + ";" + province_dict_instance + ";;" + province_dict_instance + ";;;;;;;;;\n") num += 1 loc_lines_added += 1 import logging logging.info("Localisation %s lines=%i", rel_path, loc_lines_added)
def init_loc(): """ Writes the localisation file. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\localisation\\%(number)s_province_setup.csv" % { 'number': last_file_id } import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) open(rel_path, "w") with open(rel_path, "a") as file: file.write( "#CODE;ENGLISH;FRENCH;GERMAN;;SPANISH;;;;;;;;;x\n") import logging logging.info("Init localisation %s", rel_path)
def landed_titles(province_dict, rgb_basis=(255, 102, 0)): """ Writes to the common/landed titles. """ from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') rel_path = "Output\\common\\landed_titles\\%(number)s_landed_titles.txt" % { 'number': last_file_id } rgb_value = utilities.randomise_colors(rgb_basis) import os os.makedirs(os.path.dirname(rel_path), exist_ok=True) with open(rel_path, "a") as file: file.write( "c_" + province_dict.get("county").lower().replace(" ", "_") + " = {\n") num = 1 for x in province_dict: province_dict_instance = province_dict.get("barony_" + str(num)) if province_dict_instance is None: break file.write( " b_" + province_dict_instance.lower().replace(" ", "_") + " = { }\n") num += 1 file.write(" color = { " + str(rgb_value[0]) + " " + str(rgb_value[1]) + " " + str(rgb_value[2]) + " } # rgb" + str(rgb_value) + "\n") file.write(" color2 = { " + str(rgb_basis[0]) + " " + str(rgb_basis[1]) + " " + str(rgb_basis[2]) + " } \n") file.write("}\n") import logging logging.info("Landed Titles for %s - RGB: %s", province_dict.get("county"), rgb_value)
from PyQt5 import QtWidgets from _ui.MainWindow import MainWindow if __name__ == '__main__': import sys import logging from _workbench import configs configs_obj = configs.configs() logging.basicConfig(filename='setupper.log', filemode='w+', format='%(levelname)s %(asctime)s: [ %(message)s ]', datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO) logging.info('Set-Upper Started') app = QtWidgets.QApplication(sys.argv) ui = MainWindow() ui.show() sys.exit(app.exec_())
def on_pushButton_write_pressed(self): """ Writing everything. """ from _workbench import workbench import random from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') current_version = config_obj.read_config('Basic', 'Version') username = config_obj.read_config('Basic', 'User') logging.info( 'Started Writing ~~ Version: %s ~~ User: %s ~~ Run ID: %s', current_version, username, last_file_id) global rgb_basis rgb_basis = list((rgb_basis_r, rgb_basis_g, rgb_basis_b)) if fileName is None or fileName is '': QMessageBox.critical( self, self.tr("No File"), self. tr("""No file has been loaded.\nYou need to first load a file.""" ), QMessageBox.StandardButtons(QMessageBox.Cancel)) return else: logging.info( 'Parameters: startID=%d Culture=%s Religion=%s Terrain=%s is_tribal=%s rgb_base=%s', startID, culture, religion, terrain, str(is_tribal), rgb_basis) if flag_removal is True: logging.info('Flag Removal turned on') enough_flags_check = workbench.province.read.flags.check_if_enough( fileName) if enough_flags_check is False: QMessageBox.critical( self, self.tr("Not Enough Flags"), self. tr("""Flag Removal is selected, but there are more provinces than there are flags in the folder.""" ), QMessageBox.StandardButtons(QMessageBox.Cancel)) logging.info('~~~ Aborted: Not enough flags in folder.') return else: import os psueod_flag_log_rel_path = "Databases\\Flags\\Removed\\" pseudo_log_path = psueod_flag_log_rel_path + 'removed_flag_list.log' os.makedirs(os.path.dirname(pseudo_log_path), exist_ok=True) # create folder with open(pseudo_log_path, "w+") as file: file.write("~~~~~~~~~~~~~~\nFor run ID %s\n" % (last_file_id)) pass workbench.execute.write(fileName, startID, culture, religion, is_tribal, terrain, rgb_basis, flag_removal, templeDist) logging.info('----- Exited Writing ----- ') deus_vult_mode = random.randrange(0, 15) if deus_vult_mode < 2: logging.info('DEUS VULT') print("DEUS VULT INFIDEL") for x in range(3): print("DEUS VULT DEUS VULT DEUS VULT") for x in range(3): QMessageBox.information( self, "DEUS VULT INFIDEL", "DEUS VULT DEUS VULT DEUS VULT\nDEUS VULT DEUS VULT DEUS VULT\nDEUS VULT DEUS VULT DEUS VULT\n" ) import webbrowser webbrowser.open('https://webmshare.com/play/ZQDQw') else: QMessageBox.information(self, "Complete", "Complete\n\nCheck the Output folder") from _workbench import configs logging.info('Writing Config') last_file_id_int: int = int(last_file_id) last_file_id_int += 1 last_file_id = str(last_file_id_int) config_obj.edit_config('Last_Setup', 'Last_File_ID', str(last_file_id)) if startID is not '': config_obj.edit_config('Last_Setup', 'startid', str(startID)) if culture is not '': config_obj.edit_config('Last_Setup', 'culture', culture) if religion is not '': config_obj.edit_config('Last_Setup', 'religion', religion) if terrain is not '': config_obj.edit_config('Last_Setup', 'terrain', terrain) config_obj.edit_config('Last_Setup', 'is_tribal', str(is_tribal)) config_obj.edit_config('Last_Setup', 'rgb_basis', str(rgb_basis)) config_obj.edit_config('Last_Setup', 'Last_fileName', str(fileName)) logging.info('EXECUTION COMPLETE') logging.info( "----------------------------------------------------------------------------------------------------------------------------" )
class MainWindow(QMainWindow, Ui_MainWindow): """ Class documentation goes here. """ from _workbench import configs config_obj = configs.configs() # ---- fileName global fileName fileName_str = config_obj.read_config('Last_Setup', 'Last_fileName') if fileName_str in ['None'] or fileName_str in '': fileName = None else: fileName = fileName_str from pathlib import Path my_file = Path(fileName) if not my_file.is_file(): fileName = None config_obj.edit_config('Last_Setup', 'Last_fileName', 'None') # ---- fileName End global startID startID_str = config_obj.read_config('Last_Setup', 'startID') startID = int(startID_str) global culture culture = config_obj.read_config('Last_Setup', 'culture') global religion religion = config_obj.read_config('Last_Setup', 'religion') global is_tribal is_tribal_str = config_obj.read_config('Last_Setup', 'is_tribal') if is_tribal_str in ['true']: is_tribal = True else: is_tribal = False global terrain terrain = config_obj.read_config('Last_Setup', 'terrain') global rgb_basis rgb_basis_listl = config_obj.read_config('Last_Setup', 'rgb_basis') import ast rgb_basis = ast.literal_eval(rgb_basis_listl) global rgb_basis_r rgb_basis_r = rgb_basis[0] global rgb_basis_g rgb_basis_g = rgb_basis[1] global rgb_basis_b rgb_basis_b = rgb_basis[2] global flag_removal flag_removal = False global templeDist templeDist = 0 def __init__(self, parent=None): """ Constructor @param parent reference to the parent widget @type QWidget """ super(MainWindow, self).__init__(parent) self.setupUi(self) @pyqtSlot(str) def on_lineEdit_startID_textChanged(self, p0): """ @param p0 DESCRIPTION @type str """ global startID if p0.isdigit(): startID = int(p0) else: QMessageBox.critical( self, self.tr("Not an Integer"), self.tr("""StartID requires a integer to function."""), QMessageBox.StandardButtons(QMessageBox.Cancel)) @pyqtSlot(str) def on_lineEdit_religion_textChanged(self, p0): """ @param p0 DESCRIPTION @type str """ global religion religion = p0 @pyqtSlot(str) def on_lineEdit_culture_textChanged(self, p0): """ @param p0 DESCRIPTION @type str """ global culture culture = p0 @pyqtSlot(str) def on_lineEdi_terrain_textChanged(self, p0): """ @param p0 DESCRIPTION @type str """ global terrain terrain = p0 @pyqtSlot(int) def on_spinBox_r_valueChanged(self, p0): """ @param p0 DESCRIPTION @type int """ global rgb_basis_r rgb_basis_r = p0 @pyqtSlot(int) def on_spinBox_g_valueChanged(self, p0): """ @param p0 DESCRIPTION @type int """ global rgb_basis_g rgb_basis_g = p0 @pyqtSlot(int) def on_spinBox_b_valueChanged(self, p0): """ @param p0 DESCRIPTION @type int """ global rgb_basis_b rgb_basis_b = p0 @pyqtSlot(int) def on_spinBox_templedist_valueChanged(self, p0): """ @param p0 DESCRIPTION @type int """ global templeDist templeDist = p0 @pyqtSlot(bool) def on_checkBox_isTribal_toggled(self, checked): """ @param checked DESCRIPTION @type bool """ global is_tribal is_tribal = checked @pyqtSlot(bool) def on_checkBox_flagremoval_toggled(self, checked): """ @param checked DESCRIPTION @type bool """ global flag_removal flag_removal = checked @pyqtSlot() def on_actionConfig_triggered(self): import os os.startfile('config.ini') @pyqtSlot() def on_actionQuit_triggered(self): logging.info('Quit') self.close() @pyqtSlot() def on_actionAbout_triggered(self): logging.info('About') from _ui.About import AboutUI ui = AboutUI() ui.exec_() @pyqtSlot() def on_actionHelp_triggered(self): logging.info('Help') import webbrowser webbrowser.open('https://goo.gl/RDSgwA') # Go to example.com @pyqtSlot() def on_pushButton_load_pressed(self): """ Load file """ global fileName fileName = QFileDialog.getOpenFileName(self, self.tr("Load Provinces File"), "", self.tr("*.csv;;*"), self.tr(".csv")) fileName = fileName[0] logging.info('Loaded File %s', str(fileName)) @pyqtSlot() def on_pushButton_write_pressed(self): """ Writing everything. """ from _workbench import workbench import random from _workbench import configs config_obj = configs.configs() last_file_id = config_obj.read_config('Last_Setup', 'Last_File_ID') current_version = config_obj.read_config('Basic', 'Version') username = config_obj.read_config('Basic', 'User') logging.info( 'Started Writing ~~ Version: %s ~~ User: %s ~~ Run ID: %s', current_version, username, last_file_id) global rgb_basis rgb_basis = list((rgb_basis_r, rgb_basis_g, rgb_basis_b)) if fileName is None or fileName is '': QMessageBox.critical( self, self.tr("No File"), self. tr("""No file has been loaded.\nYou need to first load a file.""" ), QMessageBox.StandardButtons(QMessageBox.Cancel)) return else: logging.info( 'Parameters: startID=%d Culture=%s Religion=%s Terrain=%s is_tribal=%s rgb_base=%s', startID, culture, religion, terrain, str(is_tribal), rgb_basis) if flag_removal is True: logging.info('Flag Removal turned on') enough_flags_check = workbench.province.read.flags.check_if_enough( fileName) if enough_flags_check is False: QMessageBox.critical( self, self.tr("Not Enough Flags"), self. tr("""Flag Removal is selected, but there are more provinces than there are flags in the folder.""" ), QMessageBox.StandardButtons(QMessageBox.Cancel)) logging.info('~~~ Aborted: Not enough flags in folder.') return else: import os psueod_flag_log_rel_path = "Databases\\Flags\\Removed\\" pseudo_log_path = psueod_flag_log_rel_path + 'removed_flag_list.log' os.makedirs(os.path.dirname(pseudo_log_path), exist_ok=True) # create folder with open(pseudo_log_path, "w+") as file: file.write("~~~~~~~~~~~~~~\nFor run ID %s\n" % (last_file_id)) pass workbench.execute.write(fileName, startID, culture, religion, is_tribal, terrain, rgb_basis, flag_removal, templeDist) logging.info('----- Exited Writing ----- ') deus_vult_mode = random.randrange(0, 15) if deus_vult_mode < 2: logging.info('DEUS VULT') print("DEUS VULT INFIDEL") for x in range(3): print("DEUS VULT DEUS VULT DEUS VULT") for x in range(3): QMessageBox.information( self, "DEUS VULT INFIDEL", "DEUS VULT DEUS VULT DEUS VULT\nDEUS VULT DEUS VULT DEUS VULT\nDEUS VULT DEUS VULT DEUS VULT\n" ) import webbrowser webbrowser.open('https://webmshare.com/play/ZQDQw') else: QMessageBox.information(self, "Complete", "Complete\n\nCheck the Output folder") from _workbench import configs logging.info('Writing Config') last_file_id_int: int = int(last_file_id) last_file_id_int += 1 last_file_id = str(last_file_id_int) config_obj.edit_config('Last_Setup', 'Last_File_ID', str(last_file_id)) if startID is not '': config_obj.edit_config('Last_Setup', 'startid', str(startID)) if culture is not '': config_obj.edit_config('Last_Setup', 'culture', culture) if religion is not '': config_obj.edit_config('Last_Setup', 'religion', religion) if terrain is not '': config_obj.edit_config('Last_Setup', 'terrain', terrain) config_obj.edit_config('Last_Setup', 'is_tribal', str(is_tribal)) config_obj.edit_config('Last_Setup', 'rgb_basis', str(rgb_basis)) config_obj.edit_config('Last_Setup', 'Last_fileName', str(fileName)) logging.info('EXECUTION COMPLETE') logging.info( "----------------------------------------------------------------------------------------------------------------------------" )
class Ui_MainWindow(object): from _workbench import configs config_obj = configs.configs() global fileName fileName = None global startID startID_str = config_obj.read_config('Last_Setup', 'startID') startID = startID_str global culture culture = config_obj.read_config('Last_Setup', 'culture') global religion religion = config_obj.read_config('Last_Setup', 'religion') global is_tribal is_tribal_str = config_obj.read_config('Last_Setup', 'is_tribal') if is_tribal_str in ['true']: is_tribal = True else: is_tribal = False global terrain terrain = config_obj.read_config('Last_Setup', 'terrain') global rgb_basis rgb_basis_listl = config_obj.read_config('Last_Setup', 'rgb_basis') import ast rgb_basis = ast.literal_eval(rgb_basis_listl) global rgb_basis_r rgb_basis_r = rgb_basis[0] global rgb_basis_g rgb_basis_g = rgb_basis[1] global rgb_basis_b rgb_basis_b = rgb_basis[2] global flag_removal flag_removal = False def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(247, 338) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setWindowTitle("Province Set-Upper") MainWindow.setAutoFillBackground(True) MainWindow.setAnimated(True) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setEnabled(True) self.centralWidget.setAutoFillBackground(True) self.centralWidget.setObjectName("centralWidget") self.widget = QtWidgets.QWidget(self.centralWidget) self.widget.setGeometry(QtCore.QRect(10, 10, 225, 280)) self.widget.setObjectName("widget") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget) self.verticalLayout_2.setContentsMargins(0, 0, 0, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.pushButton_load = QtWidgets.QPushButton(self.widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.pushButton_load.sizePolicy().hasHeightForWidth()) self.pushButton_load.setSizePolicy(sizePolicy) self.pushButton_load.setMaximumSize(QtCore.QSize(88, 23)) self.pushButton_load.setObjectName("pushButton_load") self.horizontalLayout_6.addWidget(self.pushButton_load) self.verticalLayout_2.addLayout(self.horizontalLayout_6) self.line = QtWidgets.QFrame(self.widget) self.line.setFrameShape(QtWidgets.QFrame.HLine) self.line.setFrameShadow(QtWidgets.QFrame.Sunken) self.line.setObjectName("line") self.verticalLayout_2.addWidget(self.line) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_startid = QtWidgets.QLabel(self.widget) self.label_startid.setObjectName("label_startid") self.horizontalLayout_5.addWidget(self.label_startid) self.lineEdit_startID = QtWidgets.QLineEdit(self.widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit_startID.sizePolicy().hasHeightForWidth()) self.lineEdit_startID.setSizePolicy(sizePolicy) self.lineEdit_startID.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhPreferNumbers) self.lineEdit_startID.setText(startID) self.lineEdit_startID.setPlaceholderText(startID) self.lineEdit_startID.setObjectName("lineEdit_startID") self.horizontalLayout_5.addWidget(self.lineEdit_startID) self.verticalLayout.addLayout(self.horizontalLayout_5) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.label_religion = QtWidgets.QLabel(self.widget) self.label_religion.setObjectName("label_religion") self.horizontalLayout.addWidget(self.label_religion) self.lineEdit_religion = QtWidgets.QLineEdit(self.widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit_religion.sizePolicy().hasHeightForWidth()) self.lineEdit_religion.setSizePolicy(sizePolicy) self.lineEdit_religion.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhLatinOnly|QtCore.Qt.ImhPreferNumbers) self.lineEdit_religion.setText(religion) self.lineEdit_religion.setObjectName("lineEdit_religion") self.horizontalLayout.addWidget(self.lineEdit_religion) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_culture = QtWidgets.QLabel(self.widget) self.label_culture.setObjectName("label_culture") self.horizontalLayout_2.addWidget(self.label_culture) self.lineEdit_culture = QtWidgets.QLineEdit(self.widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdit_culture.sizePolicy().hasHeightForWidth()) self.lineEdit_culture.setSizePolicy(sizePolicy) self.lineEdit_culture.setInputMethodHints(QtCore.Qt.ImhDigitsOnly|QtCore.Qt.ImhLatinOnly|QtCore.Qt.ImhPreferNumbers) self.lineEdit_culture.setText(culture) self.lineEdit_culture.setClearButtonEnabled(False) self.lineEdit_culture.setObjectName("lineEdit_culture") self.horizontalLayout_2.addWidget(self.lineEdit_culture) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_terrain = QtWidgets.QLabel(self.widget) self.label_terrain.setObjectName("label_terrain") self.horizontalLayout_4.addWidget(self.label_terrain) self.lineEdi_terrain = QtWidgets.QLineEdit(self.widget) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.lineEdi_terrain.sizePolicy().hasHeightForWidth()) self.lineEdi_terrain.setSizePolicy(sizePolicy) self.lineEdi_terrain.setInputMethodHints(QtCore.Qt.ImhLatinOnly) self.lineEdi_terrain.setText(terrain) self.lineEdi_terrain.setObjectName("lineEdi_terrain") self.horizontalLayout_4.addWidget(self.lineEdi_terrain) self.verticalLayout.addLayout(self.horizontalLayout_4) self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.label_rgbbase = QtWidgets.QLabel(self.widget) self.label_rgbbase.setObjectName("label_rgbbase") self.horizontalLayout_3.addWidget(self.label_rgbbase) self.spinBox_r = QtWidgets.QSpinBox(self.widget) self.spinBox_r.setMaximum(255) self.spinBox_r.setProperty("value", rgb_basis_r) self.spinBox_r.setObjectName("spinBox_r") self.horizontalLayout_3.addWidget(self.spinBox_r) self.spinBox_g = QtWidgets.QSpinBox(self.widget) self.spinBox_g.setMaximum(255) self.spinBox_g.setProperty("value", rgb_basis_g) self.spinBox_g.setObjectName("spinBox_g") self.horizontalLayout_3.addWidget(self.spinBox_g) self.spinBox_b = QtWidgets.QSpinBox(self.widget) self.spinBox_b.setMaximum(255) self.spinBox_b.setProperty("value", rgb_basis_b) self.spinBox_b.setObjectName("spinBox_b") self.horizontalLayout_3.addWidget(self.spinBox_b) self.verticalLayout.addLayout(self.horizontalLayout_3) self.verticalLayout_2.addLayout(self.verticalLayout) self.line_3 = QtWidgets.QFrame(self.widget) self.line_3.setFrameShape(QtWidgets.QFrame.HLine) self.line_3.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_3.setObjectName("line_3") self.verticalLayout_2.addWidget(self.line_3) self.formLayout = QtWidgets.QFormLayout() self.formLayout.setObjectName("formLayout") self.checkBox_flagremoval = QtWidgets.QCheckBox(self.widget) self.checkBox_flagremoval.setObjectName("checkBox_flagremoval") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.checkBox_flagremoval) self.checkBox_isTribal = QtWidgets.QCheckBox(self.widget) self.checkBox_isTribal.setObjectName("checkBox_isTribal") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.checkBox_isTribal) self.horizontalLayout_8 = QtWidgets.QHBoxLayout() self.horizontalLayout_8.setObjectName("horizontalLayout_8") self.label_tepledist = QtWidgets.QLabel(self.widget) self.label_tepledist.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.label_tepledist.setWordWrap(False) self.label_tepledist.setObjectName("label_tepledist") self.horizontalLayout_8.addWidget(self.label_tepledist) self.spinBox_templedist = QtWidgets.QSpinBox(self.widget) self.spinBox_templedist.setMaximum(100) self.spinBox_templedist.setObjectName("spinBox_templedist") self.horizontalLayout_8.addWidget(self.spinBox_templedist) self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_8) self.verticalLayout_2.addLayout(self.formLayout) self.line_2 = QtWidgets.QFrame(self.widget) self.line_2.setFrameShape(QtWidgets.QFrame.HLine) self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken) self.line_2.setObjectName("line_2") self.verticalLayout_2.addWidget(self.line_2) self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.pushButton_write = QtWidgets.QPushButton(self.widget) self.pushButton_write.setEnabled(True) self.pushButton_write.setIconSize(QtCore.QSize(16, 16)) self.pushButton_write.setObjectName("pushButton_write") self.horizontalLayout_7.addWidget(self.pushButton_write) self.verticalLayout_2.addLayout(self.horizontalLayout_7) MainWindow.setCentralWidget(self.centralWidget) self.menuBar = QtWidgets.QMenuBar(MainWindow) self.menuBar.setGeometry(QtCore.QRect(0, 0, 247, 21)) self.menuBar.setObjectName("menuBar") self.menuHelp = QtWidgets.QMenu(self.menuBar) self.menuHelp.setObjectName("menuHelp") self.menuFile = QtWidgets.QMenu(self.menuBar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menuBar) self.statusBar = QtWidgets.QStatusBar(MainWindow) self.statusBar.setObjectName("statusBar") MainWindow.setStatusBar(self.statusBar) self.actionQuit = QtWidgets.QAction(MainWindow) self.actionQuit.setObjectName("actionQuit") self.actionAbout = QtWidgets.QAction(MainWindow) self.actionAbout.setObjectName("actionAbout") self.actionHelp = QtWidgets.QAction(MainWindow) self.actionHelp.setObjectName("actionHelp") self.actionConfig = QtWidgets.QAction(MainWindow) self.actionConfig.setObjectName("actionConfig") self.menuHelp.addAction(self.actionAbout) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionHelp) self.menuFile.addAction(self.actionConfig) self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menuBar.addAction(self.menuFile.menuAction()) self.menuBar.addAction(self.menuHelp.menuAction()) self.label_startid.setBuddy(self.lineEdit_startID) self.label_religion.setBuddy(self.lineEdit_religion) self.label_culture.setBuddy(self.lineEdit_culture) self.label_terrain.setBuddy(self.lineEdi_terrain) self.label_rgbbase.setBuddy(self.spinBox_r) self.label_tepledist.setBuddy(self.spinBox_templedist) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.pushButton_load, self.lineEdit_startID) MainWindow.setTabOrder(self.lineEdit_startID, self.lineEdit_religion) MainWindow.setTabOrder(self.lineEdit_religion, self.lineEdit_culture) MainWindow.setTabOrder(self.lineEdit_culture, self.lineEdi_terrain) MainWindow.setTabOrder(self.lineEdi_terrain, self.spinBox_r) MainWindow.setTabOrder(self.spinBox_r, self.spinBox_g) MainWindow.setTabOrder(self.spinBox_g, self.spinBox_b) MainWindow.setTabOrder(self.spinBox_b, self.checkBox_flagremoval) MainWindow.setTabOrder(self.checkBox_flagremoval, self.checkBox_isTribal) MainWindow.setTabOrder(self.checkBox_isTribal, self.spinBox_templedist) MainWindow.setTabOrder(self.spinBox_templedist, self.pushButton_write) def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate self.pushButton_load.setToolTip(_translate("MainWindow", "Load the .csv file")) self.pushButton_load.setText(_translate("MainWindow", "Load")) self.label_startid.setText(_translate("MainWindow", "Start ID:")) self.lineEdit_startID.setToolTip(_translate("MainWindow", "<html><head/><body><p>The province ID of the first province.</p></body></html>")) self.label_religion.setText(_translate("MainWindow", "Religion:")) self.lineEdit_religion.setToolTip(_translate("MainWindow", "<html><head/><body><p>The religion of all provinces.</p></body></html>")) self.lineEdit_religion.setPlaceholderText(_translate("MainWindow", religion)) self.label_culture.setText(_translate("MainWindow", "Culture:")) self.lineEdit_culture.setToolTip(_translate("MainWindow", "<html><head/><body><p>The culture of all provinces.</p></body></html>")) self.lineEdit_culture.setPlaceholderText(_translate("MainWindow", culture)) self.label_terrain.setText(_translate("MainWindow", "Terrain:")) self.lineEdi_terrain.setAccessibleDescription(_translate("MainWindow", "The terrain of the provinces")) self.lineEdi_terrain.setPlaceholderText(_translate("MainWindow", terrain)) self.label_rgbbase.setText(_translate("MainWindow", "RGB Base:")) self.checkBox_flagremoval.setToolTip(_translate("MainWindow", "<html><head/><body><p>Put used flag into a seperate folder, filtering them out</p></body></html>")) self.checkBox_flagremoval.setText(_translate("MainWindow", "Flag Removal")) self.checkBox_isTribal.setAccessibleDescription(_translate("MainWindow", "Check if the county capital is tribal.")) self.checkBox_isTribal.setText(_translate("MainWindow", "Is Tribal")) self.label_tepledist.setText(_translate("MainWindow", "Temple Dist.:")) self.spinBox_templedist.setToolTip(_translate("MainWindow", "<html><head/><body><p>Chance that a temple will be added to the tribal holding.</p></body></html>")) self.pushButton_write.setToolTip(_translate("MainWindow", "Write the files.")) self.pushButton_write.setText(_translate("MainWindow", "Write")) self.menuHelp.setTitle(_translate("MainWindow", "Help")) self.menuFile.setTitle(_translate("MainWindow", "File")) self.actionQuit.setText(_translate("MainWindow", "Quit")) self.actionAbout.setText(_translate("MainWindow", "About")) self.actionHelp.setText(_translate("MainWindow", "Help")) self.actionConfig.setText(_translate("MainWindow", "Config"))