Esempio n. 1
0
    def setUp(self):
        self.working_dir = tempfile.mkdtemp()

        # Because uh, QSettings has very nice API so we need this
        QSettings.setDefaultFormat(QSettings.Format.IniFormat)

        # and this line, which include
        QSettings.setPath(
            QSettings.Format.IniFormat,  # this arg
            QSettings.Scope.SystemScope,
            self.working_dir,
        )

        # to have our test settings isolated from the real application.
        # Insert profanity here: ________________

        # now we make our info
        info = PMR()

        self.endpoints = [
            (info.host() + '/pmr2-dashboard',
             TestAdapter(stream=workspace_home)),
            ('http://example.com/dashboard/addworkspace',
             TestAdapter(stream='',
                         headers={
                             'Location': 'http://example.com/w/+/addworkspace',
                         })),
            (
                'http://example.com/w/+/addworkspace',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/1',
                    })),
            (
                'http://example.com/hgrepo',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/hgrepo", '
                    '"storage": "git"}', )),
            (
                'http://example.com/w/1',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/w/1", '
                    '"storage": "git"}', )),
            ('http://example.com/w/1/request_temporary_password',
             TestAdapter(stream='{"user": "******", "key": "secret"}', )),
            (info.host() + '/search',
             TestAdapter(stream='[{"title": "Test Workspace", '
                         '"target": "http://example.com/w/1"}]', )),
        ]

        # and tool, with the end points.
        self._tool = self.make_tool()
Esempio n. 2
0
APPNAME = 'OpenSesame'
VERSION = 'trunk'

DEFAULTS = { 'exelocation':  "C:/Program Files/JFX/OpenSesame/openvpn.exe",
                    'windeffileloc':  "C:/Program Files/OpenVPN/config",
                        'linuxbinary':  "/usr/bin/openvpn", 
                        'linuxdeffileloc': "/home",
                        'showTrayWarning': True,
                        'defaultPort': '1194',
                        'defMgmtBasePort': '16000'
                    }

EXPORTFILES = [ 'config.ovpn',  'client.crt', 'client.key', 'ca.crt', 'ta.key' ]

settings = QSettings(QSettings.IniFormat, QSettings.UserScope, "JFX", APPNAME)
settings.setDefaultFormat(QSettings.IniFormat)
iniPath = os.path.dirname(str(settings.fileName()))

platform=sys.platform

if platform == 'win32':
    defPlatformEXE = DEFAULTS['exelocation']
    defFileLoc = DEFAULTS['windeffileloc']
elif platform == 'linux2':
    defPlatformEXE = DEFAULTS['linuxbinary']
    defFileLoc = DEFAULTS['linuxdeffileloc']
else:
    raise "Unsupported platform: %s" % platform

def md5file(filename):
    """Return the hex digest of a file without loading it all into memory"""
Esempio n. 3
0
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)

        self.setupUi(self)
        self.mainToolBar.hide()

        #self.rpack = RapidPack(self)
        self.appname = 'DeadlineCalc'
        self.calc = DeadLineCalc(self)

        self.msgBox = QtGui.QMessageBox()
        self.msgBox.setWindowTitle(self.appname)
        self.msgBox.setIcon(QtGui.QMessageBox.Critical)

        self.checkedcount = 0 #ジョブリスト中のチェックされてるジョブの数

        if not self.calc.connectServer():
            # QMessageBoxかなんか出してやるかあ
            # print("Can't Connect Deadline Server.")
            errstr = "Can't Connect Deadline Server."
            self.msgBox.setText(errstr)
            self.msgBox.setInformativeText(self.calc.errmessage)
            self.msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
            self.msgBox.exec_()

            sys.exit(-1)

        # 先にユーザ一覧取得しちゃおうかなー。
        #
        if not self.calc.getUserandProject():
            # print("getUserandProject()")
            errstr = "Error: getUserandProject() Failed."
            self.msgBox.setText(errstr)
            self.msgBox.setInformativeText(self.calc.errmessage)
            self.msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
            self.msgBox.exec_()
            sys.exit(-1)

        #self.aboutdialog.__init__("aaa")

        QSettings.setDefaultFormat(QSettings.NativeFormat)
        QtCore.QCoreApplication.setOrganizationName(self.CORP_INFO)

        self.timerid = 0
        self.dot_count = 0
        self.status_label = StatusLabel("")

        self.early_subdate = 0   # calc期間のもっとも早い送信日時
        self.late_enddate = 0    # calc期間のもっとも遅い終了日時

        #面倒だから内部ver表記でいいやあ
        verstr = "{0} v{1}".format(self.appname,self.__version__)
        self.setWindowTitle(verstr)

        QtCore.QCoreApplication.setApplicationName(self.appname)

        # Log保存用フォルダ作成
        # if (sysisWindows):
        #
        #     try:
        #         self.dochome = os.path.join(get_path(FOLDERID.Documents, user_handle=None), self.appname)
        #
        #     except PathNotFoundException as patherr:
        #
        #
        #         os.sys.exit(-1)
        #         # print(self.dochome)
        # else:
        #     self.dochome = os.path.join(os.path.expanduser('~/Documents'), self.appname)
        # if not os.path.exists(self.dochome):
        #     os.mkdir(self.dochome)
        #
        # if not os.path.exists(os.path.join(self.dochome,self.Logdir)):
        #     os.mkdir(os.path.join(self.dochome,self.Logdir))
        #
        # #self.rpack.setdochome(self.dochome)
        #
        # #self.cfg = QSettings()
        # self.cfg = QSettings(self.dochome + "/" + self.appname + ".ini",QSettings.IniFormat)


        #self.plainTextEdit_jobID

        self.__initEv()
        self.__readsettings()
    def setUp(self):
        self.working_dir = tempfile.mkdtemp()

        # Because uh, QSettings has very nice API so we need this
        QSettings.setDefaultFormat(QSettings.Format.IniFormat)

        # and this line, which include
        QSettings.setPath(
            QSettings.Format.IniFormat,  # this arg
            QSettings.Scope.SystemScope,
            self.working_dir,
        )

        # to have our test settings isolated from the real application.
        # Insert profanity here: ________________

        # now we make our info
        info = PMRInfo()

        self.endpoints = [
            (info.host + '/pmr2-dashboard',
                TestAdapter(stream=workspace_home)),

            ('http://example.com/dashboard/addworkspace',
                TestAdapter(
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/+/addworkspace',
                    }
                )
            ),

            ('http://example.com/w/+/addworkspace',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='',
                    headers={
                        'Location': 'http://example.com/w/1',
                    }
                )
            ),

            ('http://example.com/hgrepo',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/hgrepo", '
                        '"storage": "mercurial"}',
                )
            ),

            ('http://example.com/w/1',
                TestAdapter(
                    # XXX need to make this a real thing when we test that
                    # responses from server matters.
                    stream='{"url": "http://example.com/w/1", '
                        '"storage": "mercurial"}',
                )
            ),

            ('http://example.com/w/1/request_temporary_password',
                TestAdapter(
                    stream='{"user": "******", "key": "secret"}',
                )
            ),

            (info.host + '/search',
                TestAdapter(
                    stream='[{"title": "Test Workspace", '
                           '"target": "http://example.com/w/1"}]',
                )
            ),

        ]

        # and tool, with the end points.
        self._tool = self.make_tool()