コード例 #1
0
 def connectToOpenClinica(self):
     """Connection to OpenClinica SOAP web services
     """
     if (OCUserDetails().connected != True):
         QtGui.QMessageBox.warning(self, "Error", "Cannot connect to OpenClinica SOAP services!")
     else:
         return True
コード例 #2
0
    def handleLogin(self):
        """Send authenticate user message to site server
        """
        username = str(self.txtUsername.text())
        password = str(self.txtPassword.text())
        passwordHash = hashlib.sha1(password).hexdigest()

        # Create connection artefact to users main OpenClinica SOAP
        ocConnectInfo = OCConnectInfo(ConfigDetails().ocWsHost, username)
        ocConnectInfo.setPasswordHash(passwordHash)

        if ConfigDetails().proxyEnabled:
            ocWebServices = OCWebServices(ocConnectInfo,
                                          ConfigDetails().proxyHost,
                                          ConfigDetails().proxyPort,
                                          ConfigDetails().noProxy,
                                          ConfigDetails().proxyAuthLogin,
                                          ConfigDetails().proxyAuthPassword)
        else:
            ocWebServices = OCWebServices(ocConnectInfo)

        successfull = False
        try:
            successfull, studies = ocWebServices.listAllStudies()
        except:
            QtGui.QMessageBox.warning(
                self, "Error",
                "Cannot communicate with the server, no network connection or the server is not running."
            )

        if (successfull):
            OCUserDetails().username = username
            OCUserDetails().passwordHash = passwordHash
            OCUserDetails().connected = True

            UserDetails().username = username
            UserDetails().clearpass = password
            UserDetails().password = passwordHash

            self.accept()
        else:
            QtGui.QMessageBox.warning(self, 'Error',
                                      'Wrong username or password.')
コード例 #3
0
    def prepareServices(self):
        """Prepare services for this module
        """
        # HTTP connection to RadPlanBio server (Database)
        self._svcHttp = HttpConnectionService(ConfigDetails().rpbHost,
                                              ConfigDetails().rpbHostPort,
                                              UserDetails())
        self._svcHttp.application = ConfigDetails().rpbApplication

        if ConfigDetails().proxyEnabled:
            self._svcHttp.setupProxy(ConfigDetails().proxyHost,
                                     ConfigDetails().proxyPort,
                                     ConfigDetails().noProxy)
        if ConfigDetails().proxyAuthEnabled:
            self._svcHttp.setupProxyAuth(ConfigDetails().proxyAuthLogin,
                                         ConfigDetails().proxyAuthPassword)

        # Read partner site of logged user
        self._mySite = self._svcHttp.getMyDefaultAccount().partnersite

        # Create connection artefact to users main OpenClinica SOAP
        baseUrl = self._mySite.edc.soapbaseurl
        self.ocConnectInfo = OCConnectInfo(baseUrl, OCUserDetails().username)
        self.ocConnectInfo.setPasswordHash(OCUserDetails().passwordHash)

        if ConfigDetails().proxyEnabled:
            self.ocWebServices = OCWebServices(
                self.ocConnectInfo,
                ConfigDetails().proxyHost,
                ConfigDetails().proxyPort,
                ConfigDetails().noProxy,
                ConfigDetails().proxyAuthLogin,
                ConfigDetails().proxyAuthPassword)
        else:
            self.ocWebServices = OCWebServices(self.ocConnectInfo)

        # ODM XML metadata processing
        self.fileMetaDataService = OdmFileDataService()
        # DICOM PROCESSING SERVICE
        self._svcDicom = DicomService()
コード例 #4
0
    def prepareServices(self):
        """Prepare services for this module
        """
        # HTTP connection to RadPlanBio server (Database)
        self.svcHttp = HttpConnectionService(ConfigDetails().ocHost, ConfigDetails().ocPort, UserDetails())

        if ConfigDetails().proxyEnabled:
            self.svcHttp.setupProxy(ConfigDetails().proxyHost, ConfigDetails().proxyPort, ConfigDetails().noProxy)
        if ConfigDetails().proxyAuthEnabled:
            self.svcHttp.setupProxyAuth(ConfigDetails().proxyAuthLogin, ConfigDetails().proxyAuthPassword)

        # Create connection artefact to users main OpenClinica SOAP
        self.ocConnectInfo = OCConnectInfo(ConfigDetails().ocWsHost, OCUserDetails().username)
        self.ocConnectInfo.setPasswordHash(OCUserDetails().passwordHash)

        if ConfigDetails().proxyEnabled:
            self.ocWebServices = OCWebServices(self.ocConnectInfo, ConfigDetails().proxyHost, ConfigDetails().proxyPort, ConfigDetails().noProxy, ConfigDetails().proxyAuthLogin, ConfigDetails().proxyAuthPassword)
        else:
            self.ocWebServices = OCWebServices(self.ocConnectInfo)

        # ODM XML metadata processing
        self.svcOdm = OdmFileDataService()
コード例 #5
0
    def __init__(self, parent=None):
        """Constructor of DicomUploadModule
        """
        # Setup GUI
        QWidget.__init__(self, parent)
        self.parent = parent
        self.setupUi(self)

        # Setup logger - use config file
        self.logger = logging.getLogger(__name__)
        logging.config.fileConfig('logging.ini',
                                  disable_existing_loggers=False)

        # List of worker threads
        self._threadPool = []

        # Initialise main data members
        self._mySite = None
        # Prepares services and main data for this ViewModel
        self.prepareServices()

        # Initialize data structures for UI
        self._downloadDir = None
        self._studies = []
        self._studySubjects = []

        # Initial data load
        self.reloadData()

        # Finish UI setup
        self.lblOcConnection.setText("[" + OCUserDetails().username + "] " +
                                     self._mySite.edc.soapbaseurl)

        # Register handlers
        self.btnDownload.clicked.connect(self.btnDownloadClicked)
        self.cmbStudy.currentIndexChanged['QString'].connect(
            self.cmbStudyChanged)
        self.destroyed.connect(self.handleDestroyed)
コード例 #6
0
    def __init__(self, parent = None):
        """Default Constructor
        """
        # Setup GUI
        QWidget.__init__(self, parent)
        self.parent = parent
        self.setupUi(self)

        # Hide summary of XML for importing data to OC (for user not necessary)
        self.lblSummary.hide()

        # Setup logger - use config file
        self._logger = logging.getLogger(__name__)
        logging.config.fileConfig("logging.ini", disable_existing_loggers=False)

        # List of worker threads
        self._threadPool = []

        # Prepares services and main data for this ViewModel
        self.prepareServices()

        # Initialize data structures for UI
        self._studies = []
        self._studySubjects = []

        self.reloadData()

        # Finish UI setup
        self.lblOcConnection.setText("[" + OCUserDetails().username + "] " + ConfigDetails().ocHost)

        # Register handlers
        self.btnReloadStudySubjects.clicked.connect(self.btnReloadStudySubjectsClicked)
        self.btnNewStudySubject.clicked.connect(self.btnNewStudySubjectClicked)
        self.btnNewEvent.clicked.connect(self.btnNewEventClicked)
        self.btnUpload.clicked.connect(self.btnImportClicked)
        self.cmbStudy.currentIndexChanged["QString"].connect(self.cmbStudyChanged)
        self.destroyed.connect(self.handleDestroyed)
sys.path.insert(0, os.path.abspath("./../"))

# Contexts
from contexts.OCUserDetails import OCUserDetails
from contexts.ConfigDetails import ConfigDetails
from contexts.UserDetails import UserDetails

# Services
from rest.HttpConnectionService import HttpConnectionService
from soap.OCConnectInfo import OCConnectInfo
from soap.OCWebServices import OCWebServices

ocWsHost = "http://skripcak.net:8080/OpenClinica-ws"
password = "******"

OCUserDetails().username = "******"
OCUserDetails().connected = False

# Create connection artefact to users main OpenClinica SOAP
ocConnectInfo = OCConnectInfo(ocWsHost, OCUserDetails().username)
ocConnectInfo.setPassword(password)

# Initialise SOAP services
ocWebServices = OCWebServices(ocConnectInfo)

successfull = False
try:
    successfull, studies = ocWebServices.listAllStudies()
except:
    print "Cannot communicate with the server, no network connection or the server is not running."
コード例 #8
0
import sys, os

sys.path.insert(0,os.path.abspath("./../"))

# Contexts
from contexts.OCUserDetails import OCUserDetails

# Services
from soap.OCConnectInfo import OCConnectInfo
from soap.OCWebServices import OCWebServices

ocWsHost = "http://skripcak.net:8080/OpenClinica-ws"
password = "******"

OCUserDetails().username = "******"
OCUserDetails().connected = False

# Create connection artefact to users main OpenClinica SOAP 
ocConnectInfo = OCConnectInfo(
        ocWsHost, 
        OCUserDetails().username
    )
ocConnectInfo.setPassword(password)

# Initialise SOAP services
# Debug lvls ... trace=logging.INFO, trace=logging.DEBUG in OCWebServices constructor 
ocWebServices = OCWebServices(ocConnectInfo)

successfull = False
try:
    successfull, studies = ocWebServices.listAllStudies()
コード例 #9
0
ファイル: mainClient.py プロジェクト: wahyuwh/rpb-client
    def __init__(self, parent=None):
        """Constructor of main application widnow
        """
        QMainWindow.__init__(self, parent)

        self._logger = logging.getLogger(__name__)
        logging.config.fileConfig("logging.ini",
                                  disable_existing_loggers=False)

        self.setupUi(self)
        self.statusBar.showMessage("Ready")

        self._logger.info("RadPlanBio host: " + ConfigDetails().rpbHost + ":" +
                          str(ConfigDetails().rpbHostPort))
        self._logger.info("Partner site proxy: " + ConfigDetails().proxyHost +
                          ":" + str(ConfigDetails().proxyPort) + " [" +
                          str(ConfigDetails().proxyEnabled) + "]")

        self.svcHttp = HttpConnectionService(ConfigDetails().rpbHost,
                                             ConfigDetails().rpbHostPort,
                                             UserDetails())
        self.svcHttp.application = ConfigDetails().rpbApplication
        if ConfigDetails().proxyEnabled:
            self.svcHttp.setupProxy(ConfigDetails().proxyHost,
                                    ConfigDetails().proxyPort,
                                    ConfigDetails().noProxy)
        if ConfigDetails().proxyAuthEnabled:
            self.svcHttp.setupProxyAuth(ConfigDetails().proxyAuthLogin,
                                        ConfigDetails().proxyAuthPassword)

        self.lblRPBConnection.setText("[" + UserDetails().username + "]@" +
                                      ConfigDetails().rpbHost + "/" +
                                      ConfigDetails().rpbApplication + ":" +
                                      str(ConfigDetails().rpbHostPort))

        try:
            defaultAccount = self.svcHttp.getMyDefaultAccount()
        except Exception:
            self._logger.info("HTTP communication failed.")

        if defaultAccount.ocusername and defaultAccount.ocusername != "":
            ocUsername = defaultAccount.ocusername
            ocPasswordHash = self.svcHttp.getOCAccountPasswordHash()
            ocSoapBaseUrl = defaultAccount.partnersite.edc.soapbaseurl

            successful = False
            try:
                # Create connection artifact to OC
                self.ocConnectInfo = OCConnectInfo(ocSoapBaseUrl, ocUsername)
                self.ocConnectInfo.setPasswordHash(ocPasswordHash)

                if ConfigDetails().proxyEnabled:
                    self.ocWebServices = OCWebServices(
                        self.ocConnectInfo,
                        ConfigDetails().proxyHost,
                        ConfigDetails().proxyPort,
                        ConfigDetails().noProxy,
                        ConfigDetails().proxyAuthLogin,
                        ConfigDetails().proxyAuthPassword)
                else:
                    self.ocWebServices = OCWebServices(self.ocConnectInfo)

                successful, studies = self.ocWebServices.listAllStudies()
            except:
                self._logger.info("HTTP OC communication failed.",
                                  exc_info=True)

            if successful:
                ocUserDetails = OCUserDetails()
                ocUserDetails.username = ocUsername
                ocUserDetails.passwordHash = ocPasswordHash
                ocUserDetails.connected = True
            else:
                QtGui.QMessageBox.warning(self, "Error",
                                          "Wrong username or password!")