Пример #1
0
	def updateTrials(self, dateQ, xmlTrialQ):
		print "=updateTrials"
		try:
			database = db.DBManager(self.dbPath, mutable=True)
			database.open()
		except db.DBException as e:
			print e
			sys.exit(1)

		pass # Code below is untested as yet...

		importer = db.TrialImporter(database)
		first = True
		threadName = threading.current_thread().name

		print "=importer created %d %d %s" % (first, xmlTrialQ.qsize(), threadName)

		while first or not dateQ.empty() or not xmlTrialQ.empty():
			print "=will insert trial %s" % (threadName)
			(sortNumber, xmlTrial) = xmlTrialQ.get()
			importer.updateTrial(xmlTrial)
			print "=inserted %s %s" % (xmlTrial.nctID, threadName)
			xmlTrialQ.task_done()
			first = False
			print "=xmlTrialQ size=%d dateQ size=%d" % (xmlTrialQ.qsize(), dateQ.qsize())

		importer.commitTrials()
		database.close()
Пример #2
0
	def fetchStartDate(self):
		startDate = None

		try:
			database = db.DBManager(self.dbPath, mutable=True)
			database.open()

			startDate = database.newestLastChangedDate()

			database.close()
		except db.DBException as e:
			print e
			sys.exit(1)

		return startDate
Пример #3
0
 def setUp(self):
     self.dbm = db.DBManager()
     self.dbm.add_users([
         {
             'email': '*****@*****.**',
             'pwd': 'test', 'name': ['test', 'test', 'test'], 'position': 'test'
         },
         {
             'email': '*****@*****.**',
             'pwd': 'test', 'name': ['test', 'test', 'test'], 'position': 'test'
         }
     ])
     self.dbm.add_projects([
         {'name': 'test0', 'deadline': '12-12-2020'},
         {'name': 'test1', 'deadline': '12-12-2020'}
     ])
Пример #4
0
def fullpath():
    """
    :rtype: str
    :return: Full path to the application chosen to open .torrent files (default one or that selected by the user).

    :exception WindowsError
        Either there's no default application, or the application manually selected has been deleted/moved.
    """
    config = db.DBManager().get_config()
    if config.use_default_app:
        app_path = default_application_fullpath()
    else:
        app_path = config.app_path
    if os.path.exists(app_path) and app_path.endswith(".exe"):
        return app_path
    else:
        raise WindowsError
Пример #5
0
import sys
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
import db

import ui
import edit_ship_loc

dbm = db.DBManager()


class ExampleApp(QtWidgets.QMainWindow, ui.Ui_MainWindow):
    def __init__(self):
        super().__init__()
        self.setupUi(self)

        self.ports_len = None
        self.ships_len = None
        self.free_ships_len = None
        self.data_len = None
        self.update_ports_table()

        self.selected_ship_in_seaport = []
        self.selected_port = []

        # buttons events
        self.tabWidget.currentChanged.connect(self.update_all_tables)

        self.ports_table.itemSelectionChanged.connect(
            self.ship_in_seaport_table_update)
        self.add_seaport.clicked.connect(self.add_seaport_click)