예제 #1
0
    def __init__(self):
        '''
        Constructor
        '''
        self.win = WinMain(self)
        self.win.show()

        self.cfg = kmxINIConfigReadWrite.INIConfig("config.ini")
        self.iconPath = self.cfg.getOption('UserInterface', 'IconPath')
        self.icons = core.icons.iconSetup()

        self.tls = kmxTools.Tools(kmxTools.infoStyle())
        self.qtConsole = DevConsolePlug.DevConsole(
            self.win,
            ShowPrint=True,
            ShowError=False,
            StatusBar=self.win.statusBar(),
            AsDock=True,
            InitalizeScripts=True)
        self.qtTrees = kmxQtTreeWidget.TreeWidget()
        self.qtTools = kmxQtCommonTools.CommonTools(self.win, self.iconPath)
        self.qtConn = kmxQtConnections.QtConnections(self.win)
        self.setupUI()
        if (os.path.exists('layout.lyt')):
            self.qtTools.uiLayoutRestore('layout.lyt', [self.win.splitter_2])
        self.tell("Ready!")
        self.currentNode = None
        self.selectedInputVariable = None
예제 #2
0
 def __init__(self, ppgObj):
     self.ppg = ppg(None)
     self.ppg = ppgObj
     self.infoStyle = kmxTools.infoStyle()
     self.infoStyle.errorLevel = 2
     self.infoStyle.infoLevel = 0
     self.tls = kmxTools.Tools(self.infoStyle)
예제 #3
0
    def __init__(self):
        '''
        Constructor
        '''
        self.win = WinMain(self)
        self.win.show()

        self.cfg = kmxINIConfigReadWrite.INIConfig("config.ini")
        self.iconPath = self.cfg.getOption('UserInterface', 'IconPath')
        self.icons = core.icons.iconSetup()
        self.infoStyle = kmxTools.infoStyle()
        self.infoStyle.errorLevel = 2
        self.infoStyle.infoLevel = 0

        self.tls = kmxTools.Tools(self.infoStyle)
        self.qtTools = kmxQtCommonTools.CommonTools(self.win, self.iconPath)
        self.qtTrees = kmxQtTreeWidget.TreeWidget()
        self.qtTools.applyStyle()
        dv = self.qtTools.getIconString('/04/16/39.png')
        self.qtConsole = DevConsolePlug.DevConsole(
            self.win,
            ShowPrint=True,
            ShowError=True,
            StatusBar=self.win.statusBar,
            AsDock=True,
            InitalizeScripts=True,
            logCount=30,
            btnIcon=dv,
            addObj=self)

        self.loadProject("currentProj")
예제 #4
0
 def __init__(self, parentWindow, iconPath=None):
     '''
     Constructor
     '''
     self.CallingUI = parentWindow
     self.IconPath = iconPath
     self.defaultIcon = "NoIcon.png"
     self.infoStyle = kmxTools.infoStyle()
     self.ttls = kmxTools.Tools(self.infoStyle)
     if self.IconPath is None:
         self.cfg = kmxINIConfigReadWrite.INIConfig("config.ini",
                                                    writeOk=False)
         if (self.cfg.iniReady):
             self.iconPath = self.cfg.getOption('UserInterface', 'IconPath')
         else:
             self.IconPath = "../icons/"
예제 #5
0
    def __init__(self):
        '''
        Constructor
        '''
        settingsLib.settings.__init__(self, None)
        widgetsLib.dynamicObjs.__init__(self, None)
        saftyLib.cryption.__init__(self, self)
        self.qtTools = kmxQtCommonTools.CommonTools(self)
        self.ttls = kmxTools.Tools()
        self.qtTree = kmxQtTreeWidget.TreeWidget()
        self.qtMenu = kmxQtMenuBuilder.MenuBuilder()
        self.qtConn = kmxQtConnections.QtConnections(self)
        self.qtIcon = kmxQtCommonTools.iconSetup(self)

        self.inter = InteractiveInterpreter()
        self.inter.locals['dev'] = self
        globals()['dev'] = self
예제 #6
0
    def __init__(self):
        '''
        Constructor
        '''
        self.win = WinMain(self)
        self.win.show()

        self.cfg = kmxINIConfigReadWrite.INIConfig("config.ini")
        self.iconPath = self.cfg.getOption('UserInterface', 'IconPath')
        self.icons = core.icons.iconSetup()

        self.tls = kmxTools.Tools(kmxTools.infoStyle())
        self.qtConsole = DevConsolePlug.DevConsole(
            self.win,
            ShowPrint=True,
            ShowError=True,
            StatusBar=self.win.statusBar(),
            AsDock=True,
            InitalizeScripts=True)
        self.qtTrees = kmxQtTreeWidget.TreeWidget()
        self.qtTools = kmxQtCommonTools.CommonTools(self.win, self.iconPath)
        self.setupUI()
예제 #7
0
    def __init__(self, winHandle=None, ppgFolder="defaultPPGFolder"):
        if (winHandle is None): return  # For Fake Objs
        self.infoStyle = kmxTools.infoStyle()
        self.infoStyle.errorLevel = 2
        self.infoStyle.infoLevel = 0
        self.tls = kmxTools.Tools(self.infoStyle)

        self.general = General()
        self.UISettings = UISettings()
        self.py2exe = Py2Exe()

        self.listOfScreenObjs = []
        self.listOfScreenObjs.append(self.general)
        self.listOfScreenObjs.append(self.UISettings)
        self.listOfScreenObjs.append(self.py2exe)

        self.mainWindow = winHandle
        self.projFolder = ppgFolder
        self.ppgFolder = ppgFolder
        self._doBasicSetup()

        self.setCurrentScreen(self.getScreenNameForObject(self.general))
예제 #8
0
    def __init__(self,
                 parent=None,
                 ShowPrint=True,
                 ShowError=True,
                 StatusBar=None,
                 AsDock=False,
                 logCount=30,
                 ScriptsPath='Scripts/',
                 InitalizeScripts=True,
                 btnText="Console",
                 btnIcon="F:/04/06/29.PNG",
                 addObj=None):
        '''
        Parent - Pass QWIDGET based objects. Else I will create my own.
        ShowPrint - Redirect standard prints
        ShowError - Redirect standard errors
        StatusBar - Attach DevC Invoke button to this status bar else You should invoke DevC explicitly
        AsDock - If True creates DevC as a dock else as a dialog window
        '''
        last_update_date = 'July 02 2015'  # July 02 2015 , Jan 12 2013
        self.addObj = addObj
        self.parent = parent
        self.asDock = AsDock
        self.logCount = logCount

        super(DevConsole, self).__init__(self.parent)
        atexit.register(self.writeToLog)

        # Load File
        self.loadedFile = False
        self.loadedFileName = ''
        self.pyDesigner = 'C:\Python34\Lib\site-packages\PyQt5\designer.exe'

        #Flags
        self.qtTools = kmxQtCommonTools.CommonTools(self)
        self.ttls = kmxTools.Tools()
        self.qtTree = kmxQtTreeWidget.TreeWidget()
        self.qtMenu = kmxQtMenuBuilder.MenuBuilder()
        self.qtConn = kmxQtConnections.QtConnections(self)
        self.qtIcon = kmxQtCommonTools.iconSetup(self)

        self.standalone = 0 if self.parent else 1

        if self.standalone:
            print('No parent specified! Creating standalone console!')
            self.parent = self.win = QtWidgets.QMainWindow()
            self.win.resize(689, 504)

            self.mainWidget = QtWidgets.QWidget(self.win)
            self.setupUi(self.mainWidget)
            self.win.setCentralWidget(self.mainWidget)
            self.toolbar = QtWidgets.QToolBar('Main Tools', self)
            self.toolbar2 = QtWidgets.QToolBar('Additional Tools', self)
            self.toolbar.setFloatable(True)
            self.toolbar2.setFloatable(True)
            self.win.addToolBar(self.toolbar)
            self.win.addToolBar(self.toolbar2)
            self.setStandAloneModeFeatures()

            self.btnExecute.setVisible(0)
            self.btnLoadScript.setVisible(0)
            self.btnSaveScript.setVisible(0)
            self.btnNewScript.setVisible(0)
            self.btnQuickSaveScript.setVisible(0)

            self.label.setVisible(1)
            self.label.setText('Output:')
            self.line.setVisible(0)
            #self.sciOutput.resize(self.sciOutput.width(), self.sciOutput.height() + 90)

        elif self.asDock:
            if hasattr(self.parent, 'addDockWidget'):
                print('Creating dock based console!')
                self.win = QtWidgets.QDockWidget(self.parent)
                base = QtWidgets.QWidget()
                self.setupUi(base)
                self.win.setWidget(base)
                self.parent.addDockWidget(QtCore.Qt.DockWidgetArea(2),
                                          self.win)

                # print ('Creating dock based console!')
                # self.dck = QtWidgets.QDockWidget(self.parent)
                #
                # dlg = QtWidgets.QWidget()
                #
                # self.win = QtWidgets.QMainWindow()
                # lyt = QtWidgets.QVBoxLayout()
                # lyt.addWidget(self.win)
                # wdgt = QtWidgets.QWidget(self.dck)
                # self.setupUi(wdgt)
                # self.win.setCentralWidget(wdgt)
                #
                # dlg.setLayout(lyt)
                #
                # self.dck.setWidget(dlg)
                # self.parent.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dck)

            else:
                print('Unsupported Parent for creating dock based console! ' +
                      str(self.parent))
                print('Connecting console to given parent as a dialog...' +
                      str(self.parent))
                self.win = QtWidgets.QDialog(self.parent)
                self.setupUi(self.win)
        else:
            print('Connecting console to given parent as a dialog...' +
                  str(self.parent))
            self.win = QtWidgets.QDialog(self.parent)
            self.setupUi(self.win)

        self.outputFont = self.sciOutput.font()
        self.outputFont.setFamily("Courier")
        self.outputFont.setPointSize(10)
        self.outputFont.setFixedPitch(True)
        self.sciOutput.setFont(self.outputFont)
        self.sciOutput.setMarginsFont(self.outputFont)

        print(
            "Outputs Redirected to HaPy. Check HaPy console log for furthur system messages."
        )
        if ShowPrint: sys.stdout = self
        if ShowError: sys.stderr = self

        self.inter = InteractiveInterpreter()
        self.inter.locals['dev'] = self
        globals()['dev'] = self

        self.win.setWindowIcon(self.parent.windowIcon())
        self.win.setWindowTitle('HaPy')

        self.PLX = Qsci.QsciLexerPython(self)
        self.ABS = Qsci.QsciAPIs(self.PLX)
        # self.PLX.setAPIs(self.ABS)
        self.ABS.prepare()

        self.sciOutput.setReadOnly(1)
        self._setQSci(self.sciOutput)

        # Connections
        self.tabWidget.tabCloseRequested.connect(self.tabClose)

        if not self.standalone:
            self.btnExecute.clicked.connect(self.btnRedirector)
            #self.btnExecute_2.clicked.connect(self.btnRedirector)
            self.btnLoadScript.clicked.connect(self.btnRedirector)
            self.btnSaveScript.clicked.connect(self.btnRedirector)
            self.btnNewScript.clicked.connect(self.btnRedirector)
            self.btnQuickSaveScript.clicked.connect(self.btnRedirector)

        self.qtTools.connectToRightClick(self.treeWidget,
                                         self.pluginRightClick)
        self.tabWidget.__class__.keyReleaseEvent = self.tabKeyPress

        if StatusBar:
            self.stsBtnDebugger = QtWidgets.QToolButton(self.parent)
            self.stsBtnDebugger.setText(btnText)
            self.stsBtnDebugger.setToolTip(btnText)
            self.stsBtnDebugger.setAutoRaise(1)
            self.stsBtnDebugger.setMaximumHeight(18)
            StatusBar.addPermanentWidget(self.stsBtnDebugger, 0)
            self.stsBtnDebugger.clicked.connect(self.btnRedirector)
            icon = QtGui.QIcon()
            icon.addPixmap(QtGui.QPixmap(btnIcon), QtGui.QIcon.Normal,
                           QtGui.QIcon.On)
            self.stsBtnDebugger.setIcon(icon)
        else:
            self.stsBtnDebugger = None

        self.win.hide()

        # Plugin Lister
        #self.treeWidget.headerItem().setText(0, "DevS")
        self.treeWidget.itemDoubleClicked.connect(self.pluginSelected)

        self.treeWidget.setVisible(False)

        print('---------------------------------------')
        print('HaPy - Handy Python')
        print('Interactive Interpreter')
        print('---------------------------------------')
        print('Initiated!')

        print('\nLog Start Time: ' + str(strftime("%Y/%m/%d %H:%M:%S")))
        print('\n---------------------------------------\n')
        print('*** Python %s on %s.***' % (sys.version, sys.platform))
        print(sys.copyright)
        print('')
        print('Platform: ' + sys.platform)
        print('Version: ' + str(sys.getwindowsversion()))
        print('FileSys encodeing: ' + str(sys.getfilesystemencoding()))

        drline = "\n---------------------------------------\n"
        self.credit = drline + 'About HaPy:\nHandy Python - Interactive Interpreter/Scripting Environment \nAn expreimental project by \nKumaresan Lakshmanan\nFor Quick, Portable windows automation. \nDate: ' + last_update_date + drline
        print(self.credit)

        self.InitalizeScripts = InitalizeScripts
        self.scriptsDirName = ScriptsPath
        self.scriptsPath = os.path.abspath(self.scriptsDirName)
        print("Checking scripts path..." + os.path.abspath(self.scriptsPath))

        if self.scriptsPath:
            if self.InitalizeScripts and self.scriptsPath and not os.path.exists(
                    self.scriptsPath):
                os.makedirs(self.scriptsPath)
        else:
            print('Invalid script path!')

        #Start loading the scripts...
        try:
            self.execPlugin()
            self.treeWidget.setVisible(True)
        except:
            print(errorReport())

        try:
            if self.InitalizeScripts:
                self.execStartUp()
            else:
                self.addEmptyTab()
        except:
            print(errorReport())

        if self.standalone:
            self.qtConn.uiMain = self.win
            self.qtConn.installEventHandler()
            self.qtConn.addEventConnection(self.win, 'WindowDeactivate',
                                           self.onWinDeAct)
            self.qtConn.addEventConnection(self.win, 'Close', self.onClose)
            self.qtConn.addEventConnection(self.win, 'Hide', self.onHide)
            self.qtConn.addEventConnection(self.win, 'Show', self.onShow)

            if (os.path.exists('layout.lyt')):
                customList = self.qtTools.uiLayoutRestore(
                    'layout.lyt', [self.splitter, self.splitter_2])
                if (customList):
                    self.win.resize(customList[0])
                    self.win.move(customList[1])
            self.loadTabs()
        print("All set, You are ready to go...")
예제 #9
0
listOfFiles.append(('Microsoft.VC90.CRT', glob(r'C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2\*.*')))
listOfFiles.append(('platforms', glob(r'F:\PythonWorkspace\our-py-lib\PyOneApplication\src\build\platforms\*.*')))
listOfFiles.append(('', glob(r'F:\PythonWorkspace\our-py-lib\PyOneApplication\src\template*.*')))
listOfFiles.append(('', glob(r'F:\PythonWorkspace\our-py-lib\PyOneApplication\src\help.*')))
listOfFiles.append(('', glob(r'F:\PythonWorkspace\our-py-lib\PyOneApplication\src\devSystem.*')))
listOfFiles.append(('', [requests.certs.where()]))

###########################################################################

for modulePath in modulePathList:
    modulePath = os.path.normpath(modulePath)
    print("Search Path Includes...." + str(modulePath))
    if modulePath not in sys.path and os.path.exists(modulePath):
        sys.path.append(modulePath)

k=kmxTools.Tools()

majorNumber = version.__buildNumber__.split('.')[0]
minorNumber = version.__buildNumber__.split('.')[1]
fixNumber = version.__buildNumber__.split('.')[2]
testNumber = version.__buildNumber__.split('.')[3]
history = version.__buildHistory__
changeHistory = ''

if (BUILD_TYPE==0):
    print("--------------------Performing test build--------------------")
    testNumber = int(testNumber)+1
elif (BUILD_TYPE==1):
    print("--------------------Performing fix build--------------------")    
    fixNumber = int(fixNumber)+1
    testNumber = 0