예제 #1
0
	def setTitle( self, name ):
		"""
		Fügt den Inhalt des Arguments zum Fenstertitel hinzu.
		"""

		titleStr = "{} {} ({})".format(Config.PROGRAM_NAME, Config.version(change=True), name )
		if not name:
			titleStr = "{} {}".format(Config.PROGRAM_NAME, Config.version(change=True) )
		self.setWindowTitle( titleStr )
예제 #2
0
    def setTitle(self, name):
        """
		Fügt den Inhalt des Arguments zum Fenstertitel hinzu.
		"""

        titleStr = "{} {} ({})".format(Config.PROGRAM_NAME,
                                       Config.version(change=True), name)
        if not name:
            titleStr = "{} {}".format(Config.PROGRAM_NAME,
                                      Config.version(change=True))
        self.setWindowTitle(titleStr)
예제 #3
0
	def checkXmlVersion(self, name, version, filename=None, required=False ):
		"""
		Überprüft die Version der XML-Datei. Damit ist die SoulCreator-Version gemeint.

		\param required Für den Betrieb des Programms erfordelriche Dateien sorgen dafür, daß das Programm einen entsprechend ernsten Fehler ausgibt.
		"""

		Debug.debug( "Version of file \"{name_file}\": {name} {version}".format(
			name_file=filename,
			name=name,
			version=version,
		), level=3 )

		if name == Config.PROGRAM_NAME:
			if version == Config.version():
				return
			else:
				# Unterschiede in der Minor-Version sind ignorierbar, Unterschiede in der Major-Version allerdings nicht.
				version_split = version.split(".")
				version_split = [ int(item) for item in version_split ]

				if filename is not None:
					filename = os.path.basename(filename)
				if version_split[0] < Config.PROGRAM_VERSION["major"]:
					raise Error.ErrXmlVersion(
						"XML-file \"{filename}\" was created with {program_name} {file_version} and is incompatible with {program_name} {program_version}.\nLoading of file aborted.".format(
							filename=filename,
							file_version=version,
							program_name=Config.PROGRAM_NAME,
							program_version=Config.version()
						),
						got=version,
						critical=required
					)
				else:
					raise Error.ErrXmlOldVersion(
						"XML-file \"{filename}\" was created with {program_name} {file_version} and may be compatible with {program_name} {program_version}.".format(
							filename=filename,
							file_version=version,
							program_name=Config.PROGRAM_NAME,
							program_version=Config.version()
						),
						got=version,
						critical=required
					)
		else:
			raise Error.ErrXmlVersion(
				got="{} {}".format(name, version),
				expected="{} {}".format(Config.PROGRAM_NAME, Config.version()),
				critical=required
			)
예제 #4
0
    def aboutApp(self):
        """
		Zeigt den Informationsdialog für dieses Programm an.
		"""

        aboutText = self.tr("""
			<h1>{name}</h1>
			<h2>Version: {version}</h2>
			<p>Copyright (C) {author}, 2011, 2012<br>
			EMail: {mail}</p>
			<h2>GNU General Public License</h2>
			<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
			<p>This program is distributed in the hope that it will be useful, but <i>without any warranty</i>; without even the implied warranty of <i>merchantability</i> or <i>fitness for a particular purpose</i>. See the GNU General Public License for more details.</p>
			<p>You should have received a copy of the GNU General Public License along with self program. If not, see <a>http://www.gnu.org/licenses/</a>.</p>
			<h2>World of Darkness</h2>
			<p>White Wolf and its logo, World of Darkness, Changeling the Lost, Mage the Awakening, Vampire the Requiem, and Werewolf the Forsaken are registered trademarks of White Wolf Publishing, Inc. All rights reserved. All rights reserved. The mention of or reference to any company or product in this program is not a challenge to the trademark or copyright concerned. The developers of SoulCreator are in no way affiliated with or endorsed by White Wolf Publishing, Inc. SoulCreator is intended for personal and non-profit use only.</p>
			<p>The developers make no claim to own White Wolf or any of the names related to it. Some images that are displayed as part of SoulCreator are copyrighted to White Wolf Publishing, Inc or to the creator of the image (for developer-made artwork).</p>
			""".format(
            name=Config.PROGRAM_NAME,
            version=Config.version(),
            author=Config.PROGRAM_AUTHOR,
            mail=Config.PROGRAM_AUTHOR_EMAIL,
        ))

        QMessageBox.about(self,
                          self.tr("About {}".format(Config.PROGRAM_NAME)),
                          aboutText)
예제 #5
0
	def aboutApp(self):
		"""
		Zeigt den Informationsdialog für dieses Programm an.
		"""

		aboutText = self.tr(
			"""
			<h1>{name}</h1>
			<h2>Version: {version}</h2>
			<p>Copyright (C) {author}, 2011, 2012<br>
			EMail: {mail}</p>
			<h2>GNU General Public License</h2>
			<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
			<p>This program is distributed in the hope that it will be useful, but <i>without any warranty</i>; without even the implied warranty of <i>merchantability</i> or <i>fitness for a particular purpose</i>. See the GNU General Public License for more details.</p>
			<p>You should have received a copy of the GNU General Public License along with self program. If not, see <a>http://www.gnu.org/licenses/</a>.</p>
			<h2>World of Darkness</h2>
			<p>White Wolf and its logo, World of Darkness, Changeling the Lost, Mage the Awakening, Vampire the Requiem, and Werewolf the Forsaken are registered trademarks of White Wolf Publishing, Inc. All rights reserved. All rights reserved. The mention of or reference to any company or product in this program is not a challenge to the trademark or copyright concerned. The developers of SoulCreator are in no way affiliated with or endorsed by White Wolf Publishing, Inc. SoulCreator is intended for personal and non-profit use only.</p>
			<p>The developers make no claim to own White Wolf or any of the names related to it. Some images that are displayed as part of SoulCreator are copyrighted to White Wolf Publishing, Inc or to the creator of the image (for developer-made artwork).</p>
			""".format(
				name=Config.PROGRAM_NAME,
				version=Config.version(),
				author=Config.PROGRAM_AUTHOR,
				mail=Config.PROGRAM_AUTHOR_EMAIL,
			)
		)

		QMessageBox.about(self, self.tr("About {}".format(Config.PROGRAM_NAME)), aboutText)
예제 #6
0
    ## Development. Some tasks are automatic, that normally the user would have to undertake, like choosing a file name for saving characters and other stuff. Very dangerous for normal work.
    parser.add_argument("--develop",
                        action="store_true",
                        help=argparse.SUPPRESS)
    parser.add_argument("--fallback",
                        action="store_true",
                        help=argparse.SUPPRESS)
    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        help="Output useful information.")
    parser.add_argument("-V",
                        "--version",
                        action="version",
                        version="{name}: {version}".format(
                            name=sys.argv[0], version=Config.version()))
    parser.add_argument(
        dest="file",
        metavar="File/Species",
        nargs="?",
        help=
        "Opens the character from this file at start. Instead of a file, the name of a supported species (human, changeling, mage, vampire, werewolf) may be entered, to create an empty character of the specified species, if no file of that specific name exists. This is most useful in combination with the -p option."
    )

    args = parser.parse_args()

    ## Hauptprogramm starten
    main(sys.argv,
         file=args.file,
         pdf=args.pdf,
         verbose=args.verbose,
예제 #7
0
	exe = [
		Executable(
			script="SoulCreator.py",
			base = _base,
			#targetDir = r"build/test",	# Verursacht Schwierigkeiten, denn die Module werden in ein anderes Verzeichnis geschoben.
			compress = True,
			#copyDependentFiles = True,
			#appendScriptToExe = False,
			#appendScriptToLibrary = False,
			icon = None,
		)
	]

	setup(
		name = Config.PROGRAM_NAME,
		version = Config.version(),
		description = Config.PROGRAM_DESCRIPTION,
		author = Config.PROGRAM_AUTHOR,
		author_email = Config.PROGRAM_AUTHOR_EMAIL,
		options = {
			"build_exe": {
				"includes": includes,
				"excludes": excludes,
				"packages": packages,
				"path": path,
				"include_files": includefiles,
			},
		},
		executables = exe
	)
# pylint: disable-msg=C0103




if __name__ == "__main__":
	"""
	Creates the resource files for the program.
	"""

	parser = argparse.ArgumentParser(description="Creates resource and ui-files needed to run {}.".format(Config.PROGRAM_NAME))

	parser.add_argument("-v", "--verbose", action="store_true", help="Output useful information.")
	parser.add_argument("-V", "--version", action="version", version="{name}: {version}".format(
		name=sys.argv[0],
		version=Config.version(change=True)
	))

	args = parser.parse_args()

	cmd_path = Config.PATH_RESOURCE_BUILDER
	conversion_targets = {
		"qrc": {
			"dir": Config.PATH_RESOURCE,
			"ext": Config.FILEXT_RESOURCE,
		},
		"ui": {
			"dir": Config.PATH_UI,
			"ext": Config.FILEXT_UI,
		},
	}
	def buildXmlTree(self):
		"""
		Erzeugt den Element-Baum, der später in eine XML-Datei geschrieben werden kann.
		"""

		root = etree.Element(Config.PROGRAM_NAME, version=Config.version())

		etree.SubElement(root, "species").text = self.__character.species

		etree.SubElement(root, "era").text = self.__character.era

		## Identität
		identities = etree.SubElement(root, "identities")
		forenames = " ".join(self.__character.identity.forenames)
		etree.SubElement(identities, "identity",
			forenames=forenames,
			surname=self.__character.identity.surname,
			honorname=self.__character.identity.honorname,
			nickname=self.__character.identity.nickname,
			supername=self.__character.identity.supername,
			gender=self.__character.identity.gender,
		)

		## Daten
		etree.SubElement(root, "dates",
			birth=self.__character.dateBirth.toString(Config.DATE_FORMAT),
			becoming=self.__character.dateBecoming.toString(Config.DATE_FORMAT),
			game=self.__character.dateGame.toString(Config.DATE_FORMAT),
		)

		etree.SubElement(root, "virtue").text = self.__character.virtue

		etree.SubElement(root, "vice").text = self.__character.vice

		breedElement = etree.SubElement(root, "breed")
		breedElement.text = self.__character.breed
		if self.__character.bonus:
			breedElement.attrib["bonusType"] = self.__character.bonus["type"]
			breedElement.attrib["bonusName"] = self.__character.bonus["name"]
			if "specialty" in self.__character.bonus:
				breedElement.attrib["bonusSpecialty"] = self.__character.bonus["specialty"]
		if self.__character.species == "Changeling":
			breedElement.attrib["kith"] = self.__character.kith

		etree.SubElement(root, "faction").text = self.__character.faction

		etree.SubElement(root, "organisation").text = self.__character.organisation

		etree.SubElement(root, "party").text = self.__character.party

		etree.SubElement(root, "height").text = str(self.__character.height)

		etree.SubElement(root, "weight").text = str(self.__character.weight)

		etree.SubElement(root, "eyes").text = self.__character.eyes

		etree.SubElement(root, "hair").text = self.__character.hair

		etree.SubElement(root, "nationality").text = self.__character.nationality

		etree.SubElement(root, "description").text = self.__character.description

		etree.SubElement(root, "powerstat").text = str(self.__character.powerstat)

		etree.SubElement(root, "morality").text = str(self.__character.morality)

		## Geistesstörungen
		derangements = etree.SubElement(root, "derangements")
		for item in self.__character.derangements.items():
			if item[1]:
				etree.SubElement(derangements, "derangement", morality=str(item[0])).text = item[1]

		## Eigenschaften
		traits = etree.SubElement(root, "Traits")
		for item in self.__character.traits:
			traitTypeExists = False
			traitType = None
			for subitem in self.__character.traits[item]:
				traitCategoryExists = False
				traitCategory = None
				for subsubitem in self.__character.traits[item][subitem].values():
					## Eigenschaften müssen nur dann gespeichert werden, wenn ihr Wert != 0 ist und sie für die aktuell gewählte Spezies zur Verfügung stehen.
					if ( subsubitem.value != 0 and (not subsubitem.species or subsubitem.species == self.__character.species) ):
						if not traitTypeExists:
							traitType = etree.SubElement(traits, "Type", name=item)
							traitTypeExists = True
						if not traitCategoryExists:
							traitCategory = etree.SubElement(traitType, "Category", name=subitem)
							traitCategoryExists = True
						trait = etree.SubElement(traitCategory, "trait",
							name=subsubitem.name,
							value=str(subsubitem.value),
						)
						# Zusatztext
						if item != "Subpower" and subsubitem.custom:
							trait.attrib["customText"] =  str( subsubitem.customText )
						# Spezialisierungen
						if subsubitem.specialties:
							etree.SubElement(trait, "specialties").text = Config.XML_SEPARATION_SYMBOL.join( str(n) for n in subsubitem.specialties )

		## Gegenstände
		items = etree.SubElement(root, "Items")
		if self.__character.weapons:
			weapons = etree.SubElement(items, "Weapons")
			for category in self.__character.weapons:
				weaponCategory = etree.SubElement(weapons, "Category", name=category)
				for weapon in self.__character.weapons[category]:
					etree.SubElement(weaponCategory, "weapon").text = weapon
		if self.__character.armor:
			etree.SubElement(items, "armor", dedicated=str(self.__character.armor["dedicated"])).text = self.__character.armor["name"]
		if self.__character.equipment or self.__character.magicalTool:
			equipment = etree.SubElement(items, "Equipment")
			for item in self.__character.equipment:
				etree.SubElement(equipment, "equipment").text = item
			if self.__character.magicalTool:
				etree.SubElement(equipment, "magicalTool").text = self.__character.magicalTool
		if self.__character.automobiles:
			automobiles = etree.SubElement(items, "Automobiles")
			for typ in self.__character.automobiles:
				itemType = etree.SubElement(automobiles, "Type", name=typ)
				for automobile in self.__character.automobiles[typ]:
					etree.SubElement(itemType, "item").text = automobile
		if self.__character.extraordinaryItems:
			extraordinaries = etree.SubElement(items, "ExtraordinaryItems")
			for typ in self.__character.extraordinaryItems:
				itemType = etree.SubElement(extraordinaries, "Type", name=typ)
				for extraordinaryItem in self.__character.extraordinaryItems[typ]:
					etree.SubElement(itemType, "item").text = extraordinaryItem

		## Spezialseigenschaften der Spezies
		if self.__character.nimbus:
			etree.SubElement(root, "nimbus").text = self.__character.nimbus
		if self.__character.paradoxMarks:
			etree.SubElement(root, "paradoxMarks").text = self.__character.paradoxMarks
		if any((x.name and x.value > 0) for x in self.__character.vinculi):
			vinculi = etree.SubElement(root, "vinculi")
			for item in self.__character.vinculi:
				if item.name and item.value > 0:
					etree.SubElement(vinculi, "vinculum", value=str(item.value)).text = item.name
		companion = etree.SubElement(
			root,
			"companion",
			name = self.__character.companionName,
			power = str(self.__character.companionPower),
			finesse = str(self.__character.companionFinesse),
			resistance = str(self.__character.companionResistance),
			size = str(self.__character.companionSize),
			speedFactor = str(self.__character.companionSpeedFactor),
		)
		for item in self.__character.companionNumina:
			etree.SubElement(companion, "numen").text = item
		for item in self.__character.companionInfluences:
			if item.name and item.value > 0:
				etree.SubElement(companion, "influence", value=str(item.value)).text = item.name
		if self.__character.companionBan:
			etree.SubElement(companion, "ban").text = self.__character.companionBan
		

		if self.__character.picture:
			imageData = QByteArray()
			imageBuffer = QBuffer(imageData)
			imageBuffer.open(QIODevice.WriteOnly)
			self.__character.picture.save(imageBuffer, Config.CHARACTER_PIC_FORMAT)	# Schreibt das Bild in ein QByteArray im angegebenen Bildformat.
			imageData = imageData.toBase64().data()
			etree.SubElement(root, "picture").text = imageData.decode("UTF-8")

		return root
예제 #10
0
    exe = [
        Executable(
            script="SoulCreator.py",
            base=_base,
            #targetDir = r"build/test",	# Verursacht Schwierigkeiten, denn die Module werden in ein anderes Verzeichnis geschoben.
            compress=True,
            #copyDependentFiles = True,
            #appendScriptToExe = False,
            #appendScriptToLibrary = False,
            icon=None,
        )
    ]

    setup(name=Config.PROGRAM_NAME,
          version=Config.version(),
          description=Config.PROGRAM_DESCRIPTION,
          author=Config.PROGRAM_AUTHOR,
          author_email=Config.PROGRAM_AUTHOR_EMAIL,
          options={
              "build_exe": {
                  "includes": includes,
                  "excludes": excludes,
                  "packages": packages,
                  "path": path,
                  "include_files": includefiles,
              },
          },
          executables=exe)

    sys.exit(0)
예제 #11
0
    def __init__(self, fileName=None, exportPath=None, parent=None):
        debug_timing_start = Debug.timehook()

        super(MainWindow, self).__init__(parent)

        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        QCoreApplication.setOrganizationName(Config.ORGANIZATION)
        QCoreApplication.setApplicationName(Config.PROGRAM_NAME)
        QCoreApplication.setApplicationVersion(Config.version())

        #Debug.debug(QApplication.style())

        self.setWindowTitle("")
        self.setWindowIcon(QIcon(":/icons/images/WoD.png"))

        self.__storage = StorageTemplate(self)
        self.storeTemplateData()
        self.__character = StorageCharacter(self.__storage)
        ## Später sollte ich mich für einen entscheiden!!
        self.__readCharacter = ReadXmlCharacter(self.__character)
        self.__writeCharacter = WriteXmlCharacter(self.__character)

        self.ui.pushButton_next.clicked.connect(
            self.ui.selectWidget_select.selectNext)
        self.ui.pushButton_previous.clicked.connect(
            self.ui.selectWidget_select.selectPrevious)
        self.ui.selectWidget_select.currentRowChanged.connect(
            self.ui.stackedWidget_traits.setCurrentIndex)
        self.ui.selectWidget_select.currentRowChanged.connect(
            self.setTabButtonState)
        #self.ui.selectWidget_select.currentRowChanged.connect(self.pageChanged.emit)
        self.__character.speciesChanged.connect(
            self.ui.selectWidget_select.changeIcons)

        self.__readCharacter.exception_raised.connect(
            self.showExceptionMessage)

        # Laden der Konfiguration
        self.readSettings()

        self.populateUi()

        Debug.timesince(debug_timing_start,
                        "Time neccessary to populate the UI.")

        debug_timing_between_start = Debug.timehook()

        self.activate()

        Debug.timesince(debug_timing_between_start,
                        "Time neccessary to activate the UI.")

        debug_timing_between_start = Debug.timehook()

        self.ui.selectWidget_select.currentRowChanged.connect(
            self.showCreationPoints)

        self.ui.actionSettings.triggered.connect(self.showSettingsDialog)
        self.ui.actionNew.triggered.connect(self.newCharacter)
        self.ui.actionOpen.triggered.connect(self.openCharacter)
        self.ui.actionSave.triggered.connect(self.saveCharacter)
        self.ui.actionExport.triggered.connect(self.exportCharacter)
        self.ui.actionPrint.triggered.connect(self.printCharacter)
        self.ui.actionAbout.triggered.connect(self.aboutApp)

        self.reset()
        Debug.timesince(debug_timing_between_start,
                        "Time neccessary to set all initial values.")

        debug_timing_between_start = Debug.timehook()

        ## Wird ein Dateiname angegeben, soll dieser sofort geladen werden.
        if fileName:
            if os.path.exists(fileName):
                if GlobalState.is_verbose:
                    print("Opening file {}.".format(fileName))
                self.openCharacter(fileName)
            elif fileName.lower() in [
                    species.lower()
                    for species in self.__storage.species.keys()
            ]:
                if GlobalState.is_verbose:
                    print(
                        "Empty Charactersheet of species {} will be created.".
                        format(fileName.lower()))
                self.__character.species = fileName[0].upper(
                ) + fileName[1:].lower()
                self.__character.setModified(False)
            else:
                Shell.print_warning(
                    "A file named \"{}\" does not exist.".format(fileName))

            Debug.timesince(debug_timing_between_start,
                            "Time neccessary to load a file at startup.")

        if exportPath:
            if GlobalState.is_verbose:
                print("Creating PDF {}".format(exportPath[0]))
            # exportPath ist eine Liste mit einem einzigen Element als Inhalt (argparse)
            self.__createPdf(exportPath[0])
            # Damit das Programm ordentlich geschlossen werden kann, muß auf das Starten der Event-Loop gewartet werden. dies geht am einfachsten mit einem QTimer.
            QTimer.singleShot(0, self.close)

        Debug.timesince(
            debug_timing_start,
            "The full time span neccessary to prepare the application for user input."
        )
예제 #12
0
	def __init__(self, fileName=None, exportPath=None, parent=None):
		debug_timing_start = Debug.timehook()

		super(MainWindow, self).__init__(parent)

		self.ui = Ui_MainWindow()
		self.ui.setupUi(self)

		QCoreApplication.setOrganizationName( Config.ORGANIZATION )
		QCoreApplication.setApplicationName( Config.PROGRAM_NAME )
		QCoreApplication.setApplicationVersion( Config.version() )

		#Debug.debug(QApplication.style())

		self.setWindowTitle( "" )
		self.setWindowIcon( QIcon( ":/icons/images/WoD.png" ) )

		self.__storage = StorageTemplate( self )
		self.storeTemplateData()
		self.__character = StorageCharacter(self.__storage)
		## Später sollte ich mich für einen entscheiden!!
		self.__readCharacter = ReadXmlCharacter(self.__character)
		self.__writeCharacter = WriteXmlCharacter(self.__character)

		self.ui.pushButton_next.clicked.connect(self.ui.selectWidget_select.selectNext)
		self.ui.pushButton_previous.clicked.connect(self.ui.selectWidget_select.selectPrevious)
		self.ui.selectWidget_select.currentRowChanged.connect(self.ui.stackedWidget_traits.setCurrentIndex)
		self.ui.selectWidget_select.currentRowChanged.connect(self.setTabButtonState)
		#self.ui.selectWidget_select.currentRowChanged.connect(self.pageChanged.emit)
		self.__character.speciesChanged.connect(self.ui.selectWidget_select.changeIcons)

		self.__readCharacter.exception_raised.connect(self.showExceptionMessage)

		# Laden der Konfiguration
		self.readSettings()

		self.populateUi()

		Debug.timesince( debug_timing_start, "Time neccessary to populate the UI." )

		debug_timing_between_start = Debug.timehook()

		self.activate()

		Debug.timesince( debug_timing_between_start, "Time neccessary to activate the UI." )

		debug_timing_between_start = Debug.timehook()

		self.ui.selectWidget_select.currentRowChanged.connect(self.showCreationPoints)

		self.ui.actionSettings.triggered.connect(self.showSettingsDialog)
		self.ui.actionNew.triggered.connect(self.newCharacter)
		self.ui.actionOpen.triggered.connect(self.openCharacter)
		self.ui.actionSave.triggered.connect(self.saveCharacter)
		self.ui.actionExport.triggered.connect(self.exportCharacter)
		self.ui.actionPrint.triggered.connect(self.printCharacter)
		self.ui.actionAbout.triggered.connect(self.aboutApp)

		self.reset()
		Debug.timesince( debug_timing_between_start, "Time neccessary to set all initial values." )

		debug_timing_between_start = Debug.timehook()

		## Wird ein Dateiname angegeben, soll dieser sofort geladen werden.
		if fileName:
			if os.path.exists(fileName):
				if GlobalState.is_verbose:
					print("Opening file {}.".format(fileName))
				self.openCharacter(fileName)
			elif fileName.lower() in [ species.lower() for species in self.__storage.species.keys() ]:
				if GlobalState.is_verbose:
					print("Empty Charactersheet of species {} will be created.".format(fileName.lower()))
				self.__character.species = fileName[0].upper() + fileName[1:].lower()
				self.__character.setModified(False)
			else:
				Shell.print_warning("A file named \"{}\" does not exist.".format(fileName))

			Debug.timesince( debug_timing_between_start, "Time neccessary to load a file at startup." )

		if exportPath:
			if GlobalState.is_verbose:
				print("Creating PDF {}".format(exportPath[0]))
			# exportPath ist eine Liste mit einem einzigen Element als Inhalt (argparse)
			self.__createPdf(exportPath[0])
			# Damit das Programm ordentlich geschlossen werden kann, muß auf das Starten der Event-Loop gewartet werden. dies geht am einfachsten mit einem QTimer.
			QTimer.singleShot(0, self.close)

		Debug.timesince( debug_timing_start, "The full time span neccessary to prepare the application for user input." )
예제 #13
0
	"""

    parser = argparse.ArgumentParser(
        description="Creates resource and ui-files needed to run {}.".format(
            Config.PROGRAM_NAME))

    parser.add_argument("-v",
                        "--verbose",
                        action="store_true",
                        help="Output useful information.")
    parser.add_argument("-V",
                        "--version",
                        action="version",
                        version="{name}: {version}".format(
                            name=sys.argv[0],
                            version=Config.version(change=True)))

    args = parser.parse_args()

    cmd_path = Config.PATH_RESOURCE_BUILDER
    conversion_targets = {
        "qrc": {
            "dir": Config.PATH_RESOURCE,
            "ext": Config.FILEXT_RESOURCE,
        },
        "ui": {
            "dir": Config.PATH_UI,
            "ext": Config.FILEXT_UI,
        },
    }
예제 #14
0
	signal.signal(signal.SIGINT, signal.SIG_DFL)

	parser = argparse.ArgumentParser(description=Config.PROGRAM_DESCRIPTION)

	#parser.add_argument("-o", "--onepage", action="store_true", help="Charactersheets will consist of one page only. (Momentan noch ohne Funktion.)")
	parser.add_argument("-p", "--pdf", metavar="Name", nargs=1, help="Directly creates a pdf file of the specified name out of the loaded character and closes immediatly. If no character file is passed as an argument to this program, an empty character sheet will be created.")
	# Als Argument kann der Name oder die Nummer des Debug-levels eingegeben werden. Bei der Liste der erlaubten Möglichkeiten wird der Name immer nach der zugehörigen Nummer eingefügt.
	__choices_debug_level = []
	for item in range( len( Config.DEBUG_LEVELS ) ):
		__choices_debug_level.append( str(item) )
		__choices_debug_level.append( Config.DEBUG_LEVELS[item] )
	parser.add_argument("--debug", nargs="?", choices=__choices_debug_level, const=Config.DEBUG_LEVELS[Config.DEBUG_LEVEL_STD], default="0", help="Give debug information. {level_index_none} ({level_name_none}) means, that no debug information will be printed (standard behaviour). {level_index_normal} ({level_name_normal}) is the normal behaviour, if the option string is present, but no argument given. Debug from {level_index_mod} ({level_name_mod}) and above are not recommended for printing and/or exporting character sheets.".format(
		level_index_none=Config.DEBUG_LEVEL_NONE,
		level_name_none=Config.DEBUG_LEVELS[Config.DEBUG_LEVEL_NONE],
		level_index_normal=Config.DEBUG_LEVEL_STD,
		level_name_normal=Config.DEBUG_LEVELS[Config.DEBUG_LEVEL_STD],
		level_index_mod=Config.DEBUG_LEVEL_MODIFIES_EXPORTS,
		level_name_mod=Config.DEBUG_LEVELS[Config.DEBUG_LEVEL_MODIFIES_EXPORTS],
	) )
	## Development. Some tasks are automatic, that normally the user would have to undertake, like choosing a file name for saving characters and other stuff. Very dangerous for normal work.
	parser.add_argument("--develop", action="store_true", help=argparse.SUPPRESS)
	parser.add_argument("--fallback", action="store_true", help=argparse.SUPPRESS)
	parser.add_argument("-v", "--verbose", action="store_true", help="Output useful information.")
	parser.add_argument("-V", "--version", action="version", version="{name}: {version}".format( name=sys.argv[0], version=Config.version()) )
	parser.add_argument(dest="file", metavar="File/Species", nargs="?", help="Opens the character from this file at start. Instead of a file, the name of a supported species (human, changeling, mage, vampire, werewolf) may be entered, to create an empty character of the specified species, if no file of that specific name exists. This is most useful in combination with the -p option.")

	args = parser.parse_args()

	## Hauptprogramm starten
	main( sys.argv, file=args.file, pdf=args.pdf, verbose=args.verbose, debug=args.debug, develop=args.develop, fallback=args.fallback )