Exemple #1
0
    def createWindow(self, _actionName, _makeThisAction, _isShowEmendWidgets):
        from Options import OptionsForm

        newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
        wOptionsPanel = OptionsForm.OptionsForm(None, QuickMakeParameters[0], None, newOrChangedKeys)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setButtons(MyDialog.NoDefault)
        elif MyDialogType == "MMainWindow":
            self.setObjectName("Packager")
            setMainWindow(self)
        self.setWindowTitle(_actionName)
        pnlMain = MWidget(self)
        vblMain = MVBoxLayout(pnlMain)
        pnlInfo = MWidget()
        vblInfo = MVBoxLayout(pnlInfo)
        vblInfo.addStretch(3)
        if _isShowEmendWidgets:
            lblOldValue = MLabel(translate("QuickMake", "Old Value : "))
            lblNewValue = MLabel(translate("QuickMake", "New Value : "))
            leOldValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leOldValue.setEnabled(False)
            self.leNewValue = MLineEdit(str(Organizer.emend(fu.getRealPath(QuickMakeParameters[1]),
                                                            fu.getObjectType(fu.getRealPath(QuickMakeParameters[1])))))
            vblInfo.addWidget(lblOldValue)
            vblInfo.addWidget(leOldValue)
            vblInfo.addWidget(lblNewValue)
            vblInfo.addWidget(self.leNewValue)
        else:
            lblValue = MLabel(translate("QuickMake", "Value : "))
            leValue = MLineEdit(str(fu.getRealPath(QuickMakeParameters[1])))
            leValue.setEnabled(False)
            vblInfo.addWidget(lblValue)
            vblInfo.addWidget(leValue)
        vblInfo.addStretch(3)
        pbtnApply = MPushButton(_actionName)
        pbtnClose = MPushButton(translate("QuickMake", "Cancel"))
        MObject.connect(pbtnApply, SIGNAL("clicked()"), _makeThisAction)
        MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
        tabwTabs = MTabWidget()
        tabwTabs.addTab(pnlInfo, translate("QuickMake", "Quick Make"))
        tabwTabs.addTab(wOptionsPanel, translate("QuickMake", "Quick Make Options"))
        vblMain.addWidget(tabwTabs)
        hblBox = MHBoxLayout()
        hblBox.addWidget(pbtnClose, 2)
        hblBox.addWidget(pbtnApply, 3)
        vblInfo.addLayout(hblBox)
        if MyDialogType == "MDialog":
            if isActivePyKDE4:
                self.setMainWidget(pnlMain)
            else:
                self.setLayout(vblMain)
        elif MyDialogType == "MMainWindow":
            self.setCentralWidget(pnlMain)
            moveToCenter(self)
        self.setMinimumSize(450, 350)
Exemple #2
0
    def doAfterRunProcessesStep1(self):
        if str(fu.defaultFileSystemEncoding) != str(uni.MySettings["fileSystemEncoding"]):
            answer = Dialogs.ask(
                translate("HamsiManager", "Your System's \"File System Encoding\" Type Different"),
                translate("HamsiManager",
                          "Your system's \"File System Encoding\" type different from the settings you select. Are you sure you want to continue?If you are not sure press the \"No\"."),
                False, "Your System's \"File System Encoding\" Type Different")
            if answer == Dialogs.No:
                OptionsForm.OptionsForm(self, _focusTo="fileSystemEncoding")
        if uni.getBoolValue("isMakeAutoDesign"):
            self.TableToolsBar.setVisible(False)
            self.ToolsBar.setVisible(False)
            if isActivePyKDE4:
                self.Browser.setVisible(False)
                self.TreeBrowser.setVisible(False)
                self.FileManager.urlNavigator.setMinimumWidth(150)
                self.FileManager.tbarBrowserToolsFull.setVisible(False)
                self.tabifyDockWidget(self.Browser, self.Places)
                self.tabifyDockWidget(self.Browser, self.TreeBrowser)
                self.tabifyDockWidget(self.Browser, self.DirOperator)
            geometries = uni.getListValue("MainWindowGeometries")
            self.setGeometry(int(geometries[0]), int(geometries[1]), 900, 600)
            uni.setMySetting("isMakeAutoDesign", "False")
        if uni.isShowVerifySettings and (uni.changedDefaultValuesKeys != [] or uni.newSettingsKeys != []):
            answer = Dialogs.ask(translate("HamsiManager", "Added New Options And New Features"),
                                 translate("HamsiManager",
                                           "New options and new features added to Hamsi Manager. Are you want to change or verify new options?"),
                                 False, "Added New Options And New Features")
            if answer == Dialogs.Yes:
                newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
                OptionsForm.OptionsForm(self, "Normal", None, newOrChangedKeys)
        elif uni.getBoolValue("isShowReconfigureWizard") and uni.isBuilt() is False:
            from Tools import Configurator

            Configurator.Configurator()
            uni.setMySetting("isShowReconfigureWizard", "False")
Exemple #3
0
 def __init__(self, _directory):
     MyDialog.__init__(self, MyParent)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setButtons(MyDialog.NoDefault)
     elif MyDialogType == "MMainWindow":
         self.setObjectName("Cleaner")
         setMainWindow(self)
     newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
     wOptionsPanel = OptionsForm.OptionsForm(None, "clear", None, newOrChangedKeys)
     lblPleaseSelect = MLabel(translate("Cleaner", "Directory"))
     self.pbtnClear = MPushButton(translate("Cleaner", "Clear"))
     self.pbtnClose = MPushButton(translate("Cleaner", "Close"))
     self.lePathOfProject = MLineEdit(str(_directory))
     self.pbtnClear.setToolTip(translate("Cleaner", "Directory you selected will is cleared"))
     self.pbtnSelectProjectPath = MPushButton(translate("Cleaner", "Browse"))
     self.connect(self.pbtnSelectProjectPath, SIGNAL("clicked()"), self.selectProjectPath)
     self.connect(self.pbtnClear, SIGNAL("clicked()"), self.Clear)
     self.connect(self.pbtnClose, SIGNAL("clicked()"), self.close)
     pnlMain = MWidget(self)
     tabwTabs = MTabWidget()
     vblMain = MVBoxLayout(pnlMain)
     pnlMain2 = MWidget(tabwTabs)
     vblMain2 = MVBoxLayout(pnlMain2)
     HBox = MHBoxLayout()
     HBox.addWidget(self.lePathOfProject)
     HBox.addWidget(self.pbtnSelectProjectPath)
     HBox1 = MHBoxLayout()
     HBox1.addWidget(self.pbtnClear)
     HBox1.addWidget(self.pbtnClose)
     vblMain2.addWidget(lblPleaseSelect)
     vblMain2.addLayout(HBox)
     vblMain2.addStretch(1)
     vblMain2.addLayout(HBox1)
     tabwTabs.addTab(pnlMain2, translate("Cleaner", "Clear"))
     tabwTabs.addTab(wOptionsPanel, translate("Cleaner", "Quick Options"))
     vblMain.addWidget(tabwTabs)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setMainWidget(pnlMain)
         else:
             self.setLayout(vblMain)
     elif MyDialogType == "MMainWindow":
         self.setCentralWidget(pnlMain)
         moveToCenter(self)
     self.setWindowTitle(translate("Cleaner", "Cleaner"))
     self.setWindowIcon(MIcon("Images:clear.png"))
     self.show()
Exemple #4
0
def checkMysqldSafe(_isAskIfNotFound=True):
    from Core import Dialogs

    if fu.isFile(MySettings["pathOfMysqldSafe"]) is False and fu.isFile(
            "/usr/bin/" + MySettings["pathOfMysqldSafe"]) is False:
        if _isAskIfNotFound:
            answer = Dialogs.ask(
                translate("EmbeddedDBCore", "\"mysqld_safe\" Not Found"),
                translate(
                    "EmbeddedDBCore",
                    "Executable \"mysqld_safe\" file is not found. Are you want to set path of this file?<br><b>Note :</b> \"mysql-common\" must be installed on your system."
                ))
            if answer == Dialogs.Yes:
                from Options import OptionsForm

                OptionsForm.OptionsForm(getMainWindow(),
                                        _focusTo="pathOfMysqldSafe")
        else:
            return False
    else:
        return True
Exemple #5
0
 def __init__(self, _file=None):
     MyDialog.__init__(self, MyParent)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setButtons(MyDialog.NoDefault)
     elif MyDialogType == "MMainWindow":
         self.setObjectName("Hasher")
         setMainWindow(self)
     newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
     wOptionsPanel = OptionsForm.OptionsForm(None, "hash", None,
                                             newOrChangedKeys)
     lblPathOfPackage = MLabel(translate("Hasher", "Path Of The File : "))
     lblHash = MLabel(translate("Hasher", "Hash Type : "))
     lblHashOutput = MLabel(translate("Hasher", "Hash Output : "))
     lblHashDigestFile = MLabel(translate("Hasher", "Hash Digest File : "))
     lblHashDigest = MLabel(translate("Hasher", "Hash Digest : "))
     self.teHashDigest = MTextEdit("")
     self.cbHash = Options.MyComboBox(self, uni.getHashTypes(), 0,
                                      "HasherHash",
                                      self.pathOfPackageChanged)
     self.cbHashOutput = Options.MyComboBox(self, [
         translate("Hasher", "Only Show"),
         translate("Hasher", "File"),
         translate("Hasher", "Clipboard")
     ], 0, "HasherHashOutput", self.hashOutputChanged)
     self.leHashDigestFile = MLineEdit(str(_file))
     self.pbtnHash = MPushButton(translate("Hasher", "Hash"))
     self.pbtnClose = MPushButton(translate("Hasher", "Close"))
     self.lePathOfPackage = MLineEdit(str(_file))
     self.pbtnHash.setToolTip(translate("Hasher", "Hash the selected file"))
     self.pbtnSelectProjectPath = MPushButton(translate("Hasher", "Browse"))
     self.pbtnSelectPackagePath = MPushButton(translate("Hasher", "Browse"))
     self.connect(self.pbtnSelectPackagePath, SIGNAL("clicked()"),
                  self.selectPackagePath)
     self.connect(self.pbtnHash, SIGNAL("clicked()"), self.hash)
     self.connect(self.pbtnClose, SIGNAL("clicked()"), self.close)
     self.connect(self.lePathOfPackage,
                  SIGNAL("textChanged(const QString&)"),
                  self.pathOfPackageChanged)
     self.teHashDigest.setMaximumHeight(80)
     pnlMain = MWidget(self)
     tabwTabs = MTabWidget()
     vblMain = MVBoxLayout(pnlMain)
     pnlMain2 = MWidget(tabwTabs)
     vblMain2 = MVBoxLayout(pnlMain2)
     HBox1 = MHBoxLayout()
     HBox1.addWidget(self.pbtnHash)
     HBox1.addWidget(self.pbtnClose)
     HBox2 = MHBoxLayout()
     HBox2.addWidget(self.lePathOfPackage)
     HBox2.addWidget(self.pbtnSelectPackagePath)
     HBox3 = MHBoxLayout()
     HBox3.addWidget(lblHashDigest)
     HBox3.addWidget(self.teHashDigest)
     HBox4 = MHBoxLayout()
     HBox4.addWidget(lblHash)
     HBox4.addWidget(self.cbHash)
     HBox5 = MHBoxLayout()
     HBox5.addWidget(lblHashOutput)
     HBox5.addWidget(self.cbHashOutput)
     HBox6 = MHBoxLayout()
     HBox6.addWidget(lblHashDigestFile)
     HBox6.addWidget(self.leHashDigestFile)
     vblMain2.addWidget(lblPathOfPackage)
     vblMain2.addLayout(HBox2)
     vblMain2.addLayout(HBox4)
     vblMain2.addLayout(HBox3)
     vblMain2.addLayout(HBox5)
     vblMain2.addLayout(HBox6)
     vblMain2.addStretch(1)
     vblMain2.addLayout(HBox1)
     tabwTabs.addTab(pnlMain2, translate("Hasher", "Hash"))
     tabwTabs.addTab(wOptionsPanel, translate("Hasher", "Quick Options"))
     vblMain.addWidget(tabwTabs)
     self.pathOfPackageChanged("")
     self.hashOutputChanged(self.cbHashOutput.currentIndex())
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setMainWidget(pnlMain)
         else:
             self.setLayout(vblMain)
     elif MyDialogType == "MMainWindow":
         self.setCentralWidget(pnlMain)
         moveToCenter(self)
     self.setWindowTitle(translate("Hasher", "Hasher"))
     self.setWindowIcon(MIcon("Images:hash.png"))
     self.show()
Exemple #6
0
def clickedAnAction(_action):
    try:
        actionName = _action.objectName()
        if actionName == "Open State":
            f = Dialogs.getOpenFileName(
                translate("MenuBar", "Open State Of Hamsi Manager"),
                fu.userDirectoryPath,
                translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.openStateOfSettings(f)
        elif actionName == "Save State":
            f = Dialogs.getSaveFileName(
                translate("MenuBar", "Save State Of Hamsi Manager"),
                fu.joinPath(fu.userDirectoryPath, "HamsiManager.desktop"),
                translate("MenuBar", "Application Runner") + " (*.desktop)")
            if f is not None:
                Settings.saveStateOfSettings(f)
                Dialogs.show(
                    translate("MenuBar", "Current State Saved"),
                    translate(
                        "MenuBar",
                        "Current state saved with preferences.<br>You can continue where you left off."
                    ))
        elif actionName == "With This Profile (My Settings)":
            if Execute.executeAsRootWithThread(
                ["--sDirectoryPath", fu.pathOfSettingsDirectory],
                    "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(
                    translate("MenuBar", "Can Not Run As Root"),
                    translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "With Root Profile (Own Settings)":
            if Execute.executeAsRootWithThread([], "HamsiManager"):
                getMainWindow().close()
            else:
                Dialogs.showError(
                    translate("MenuBar", "Can Not Run As Root"),
                    translate("MenuBar", "Hamsi Manager can not run as root."))
        elif actionName == "Quit":
            getMainWindow().close()
        elif actionName == "HTML Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "html", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "html", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "html", "title")
        elif actionName == "Text Format":
            if _action.parent().objectName() == "Export To File":
                getMainTable().exportValues("file", "plainText", "title")
            elif _action.parent().objectName() == "Show In New Window":
                getMainTable().exportValues("dialog", "plainText", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                getMainTable().exportValues("clipboard", "plainText", "title")
        elif actionName == "HTML Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "file", "html", "fileTree", "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "dialog", "html", "fileTree", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "clipboard", "html", "fileTree", "title")
        elif actionName == "Text Format (File Tree)":
            if _action.parent().objectName() == "Export To File":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "file", "plainText", "fileTree", "title")
            elif _action.parent().objectName() == "Show In New Window":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "dialog", "plainText", "fileTree", "title")
            elif _action.parent().objectName() == "Copy To Clipboard":
                fu.getFileTree((getMainWindow().FileManager.currentDirectory),
                               0, "clipboard", "plainText", "fileTree",
                               "title")
        elif actionName == "About QT":
            if isActivePyKDE4:
                QMessageBox.aboutQt(getMainWindow(),
                                    translate("MenuBar", "About QT"))
            else:
                MMessageBox.aboutQt(getMainWindow(),
                                    translate("MenuBar", "About QT"))
        elif actionName == "Options":
            from Options import OptionsForm

            OptionsForm.OptionsForm(getMainWindow())
        elif actionName == "My Plugins":
            import MyPlugins

            MyPlugins.MyPlugins()
        elif actionName == "Reconfigure":
            from Tools import Configurator

            Configurator.Configurator("configurePage")
        elif actionName == "My Plugins (System)":
            Execute.execute(["--qm", "--plugins", "--runAsRoot"],
                            "HamsiManager")
        elif actionName == "Reconfigure (System)":
            Execute.execute(["--qm", "--configurator", "--runAsRoot"],
                            "HamsiManager")
        elif actionName == "Update":
            from Core import UpdateControl

            UpdateControl.UpdateControl(getMainWindow())
        elif actionName == "Report Bug":
            ReportBug.ReportBug(True)
        elif actionName == "Suggest Idea":
            from Core import SuggestIdea

            SuggestIdea.SuggestIdea()
        elif actionName == "About Hamsi Manager":
            if isActivePyKDE4 is False:
                MMessageBox.about(getMainWindow(),
                                  translate("MenuBar", "About Hamsi Manager"),
                                  uni.aboutOfHamsiManager)
        elif actionName == translate("ToolsBar", "Check Icon"):
            getMainWindow().setEnabled(False)
            fu.checkIcon(getMainWindow().FileManager.getCurrentDirectoryPath())
            Dialogs.show(
                translate("ToolsBar", "Directory Icon Checked"),
                translate(
                    "ToolsBar",
                    "Current directory icon checked.<br>The default action based on the data is executed."
                ))
            getMainWindow().setEnabled(True)
        elif actionName == "Clear Empty Directories":
            if getMainTable().checkUnSavedValues() is False:
                _action.setChecked(False)
                return False
            answer = Dialogs.ask(
                translate("ToolsBar", "Empty Directories Will Be Removed"),
                str(
                    translate(
                        "ToolsBar",
                        "Are you sure you want to remove empty directories based on the criteria you set in \"%s\"?"
                    )) % Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                currentDirPath = getMainWindow(
                ).FileManager.getCurrentDirectoryPath()
                if fu.isWritableFileOrDir(currentDirPath):
                    fu.checkEmptyDirectories(currentDirPath, True, True, True,
                                             True)
                    Dialogs.show(
                        translate("ToolsBar", "Directory Cleaned"),
                        translate(
                            "ToolsBar",
                            "The current directory is cleaned based on the criteria you set."
                        ))
                getMainWindow().setEnabled(True)
                getMainWindow().FileManager.makeRefresh()
        elif actionName == "Pack":
            from Tools import Packager

            Packager.Packager(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Hash":
            from Tools import Hasher

            Hasher.Hasher(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Clear":
            from Tools import Cleaner

            Cleaner.Cleaner(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Text Corrector":
            from Tools import TextCorrector

            TextCorrector.TextCorrector(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "File Tree":
            from Tools import FileTreeBuilder

            FileTreeBuilder.FileTreeBuilder(
                getMainWindow().FileManager.getCurrentDirectoryPath())
        elif actionName == "Search":
            from Tools import Searcher

            Searcher.Searcher(
                [getMainWindow().FileManager.getCurrentDirectoryPath()])
        elif actionName == "Script Manager":
            from Tools import ScriptManager

            if ScriptManager.ScriptManager.checkScriptManager():
                ScriptManager.ScriptManager(getMainWindow())
        elif actionName == "Show Last Actions":
            from Core import RecordsForm

            RecordsForm.RecordsForm(getMainWindow())
        elif actionName == "Remove Sub Files":
            answer = Dialogs.ask(
                translate("ToolsBar", "All Files Will Be Removed"),
                str(
                    translate(
                        "ToolsBar",
                        "Are you sure you want to remove only all files in \"%s\"?<br>Note:Do not will remove directory and subfolders."
                    )) % Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
            if answer == Dialogs.Yes:
                getMainWindow().setEnabled(False)
                fu.removeOnlySubFiles(
                    getMainWindow().FileManager.getCurrentDirectoryPath())
                getMainWindow().setEnabled(True)
                Dialogs.show(
                    translate("ToolsBar", "Removed Only All Files"),
                    str(
                        translate(
                            "ToolsBar",
                            "Removed only all files in \"%s\".<br>Note:Do not removed directory and subfolders."
                        )) %
                    Organizer.getLink(
                        getMainWindow().FileManager.getCurrentDirectoryPath()))
        elif actionName == "Amarok Embedded Database Configurator":
            import Amarok

            if Amarok.checkAmarok():
                Amarok.openEmbeddedDBConfigurator()
        elif _action.parent().objectName() == "Table Types":
            changeTableType(_action)
        elif _action.parent().objectName() == "File Renamer Types":
            changeReNamerType(_action)
        elif _action.parent().objectName() == "Scripts":
            from Core import Scripts

            Scripts.runScriptFile(
                fu.joinPath(Scripts.pathOfScripsDirectory, actionName))
        Records.saveAllRecords()
    except:
        ReportBug.ReportBug()
Exemple #7
0
 def __init__(self, _filePath):
     MyDialog.__init__(self, MyParent)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setButtons(MyDialog.NoDefault)
     elif MyDialogType == "MMainWindow":
         self.setObjectName("Cleaner")
         setMainWindow(self)
     newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
     wOptionsPanel = OptionsForm.OptionsForm(None, "textCorrector", None,
                                             newOrChangedKeys)
     self.setWindowTitle(translate("TextCorrector", "Text Corrector"))
     self.fileValues = None
     self.isChangeSourceCharSetChanged = False
     self.charSet = MComboBox()
     self.charSet.addItems(uni.getCharSets())
     self.charSet.setCurrentIndex(
         self.charSet.findText(uni.MySettings["fileSystemEncoding"]))
     self.sourceCharSet = MComboBox()
     self.sourceCharSet.addItems(uni.getCharSets())
     self.sourceCharSet.setCurrentIndex(
         self.sourceCharSet.findText(uni.MySettings["fileSystemEncoding"]))
     self.pbtnSelectFilePath = MPushButton(
         translate("TextCorrector", "Browse"))
     self.connect(self.pbtnSelectFilePath, SIGNAL("clicked()"),
                  self.selectFilePath)
     pbtnClose = MPushButton(translate("TextCorrector", "Close"))
     self.pbtnSave = MPushButton(translate("TextCorrector", "Save Changes"))
     self.pbtnSave.setIcon(MIcon("Images:save.png"))
     MObject.connect(pbtnClose, SIGNAL("clicked()"), self.close)
     MObject.connect(self.pbtnSave, SIGNAL("clicked()"), self.save)
     self.labels = [
         translate("TextCorrector", "File Path : "),
         translate("TextCorrector", "Content : ")
     ]
     pnlMain = MWidget(self)
     tabwTabs = MTabWidget()
     pnlMain2 = MWidget(tabwTabs)
     vblMain2 = MVBoxLayout(pnlMain2)
     vblMain = MVBoxLayout(pnlMain)
     self.lblFilePath = MLabel(self.labels[0])
     self.lblFileContent = MLabel(self.labels[1])
     self.leFilePath = MLineEdit(str(_filePath))
     self.pteFileContent = MPlainTextEdit(str(""))
     self.pteFileContent.setLineWrapMode(MPlainTextEdit.NoWrap)
     self.fillValues()
     MObject.connect(self.sourceCharSet, SIGNAL("currentIndexChanged(int)"),
                     self.sourceCharSetChanged)
     self.isChangeSourceCharSetChanged = True
     hbFilePath = MHBoxLayout()
     hbFilePath.addWidget(self.lblFilePath)
     hbFilePath.addWidget(self.leFilePath)
     hbFilePath.addWidget(self.pbtnSelectFilePath)
     hbFilePath.addWidget(self.sourceCharSet)
     vblMain2.addLayout(hbFilePath)
     vblMain2.addWidget(self.lblFileContent)
     vblMain2.addWidget(self.pteFileContent)
     hbControls = MHBoxLayout()
     hbControls.addWidget(self.charSet, 1)
     hbControls.addWidget(self.pbtnSave, 4)
     hbControls.addWidget(pbtnClose, 1)
     vblMain2.addLayout(hbControls, 1)
     self.leFilePath.setEnabled(False)
     tabwTabs.addTab(pnlMain2, translate("Searcher", "Search"))
     tabwTabs.addTab(wOptionsPanel, translate("Searcher", "Quick Options"))
     vblMain.addWidget(tabwTabs)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setMainWidget(pnlMain)
         else:
             self.setLayout(vblMain)
     elif MyDialogType == "MMainWindow":
         self.setCentralWidget(pnlMain)
         moveToCenter(self)
     self.show()
     self.setMinimumWidth(700)
     self.setMinimumHeight(500)
Exemple #8
0
 def __init__(self, _directory):
     MyDialog.__init__(self, MyParent)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setButtons(MyDialog.NoDefault)
     elif MyDialogType == "MMainWindow":
         self.setObjectName("Searcher")
         setMainWindow(self)
     newOrChangedKeys = uni.newSettingsKeys + uni.changedDefaultValuesKeys
     wOptionsPanel = OptionsForm.OptionsForm(None, "search", None,
                                             newOrChangedKeys)
     self.isMultipleSource = False
     self.sourceToSearchCache = {}
     self.sourceToSearch = None
     self.tmrSearchAfter = None
     lblPleaseSelect = MLabel(translate("Searcher", "Directory Or File : "))
     self.pbtnClose = MPushButton(translate("Searcher", "Close"))
     self.lePathToSeach = MLineEdit(
         str(uni.getStringFromList(_directory, ";")))
     self.pbtnSelectSeachDirectoryPath = MPushButton(
         translate("Searcher", "Select Directory"))
     self.pbtnSelectSeachFilePath = MPushButton(
         translate("Searcher", "Select File"))
     self.connect(self.pbtnSelectSeachDirectoryPath, SIGNAL("clicked()"),
                  self.selectSearchDirectoryPath)
     self.connect(self.pbtnSelectSeachFilePath, SIGNAL("clicked()"),
                  self.selectSearchFilePath)
     self.pbtnAddSeachDirectoryPath = MPushButton(
         translate("Searcher", "Add Directory"))
     self.pbtnAddSeachFilePath = MPushButton(
         translate("Searcher", "Add File"))
     self.connect(self.pbtnAddSeachDirectoryPath, SIGNAL("clicked()"),
                  self.addSearchDirectoryPath)
     self.connect(self.pbtnAddSeachFilePath, SIGNAL("clicked()"),
                  self.addSearchFilePath)
     self.connect(self.pbtnClose, SIGNAL("clicked()"), self.close)
     self.pbtnReloadSourceToSearch = MPushButton(
         translate("Searcher", "(Re)Load"))
     self.connect(self.pbtnReloadSourceToSearch, SIGNAL("clicked()"),
                  self.reloadSourceToSearch)
     self.pbtnSearch = MPushButton(translate("Searcher", "Search"))
     self.connect(self.pbtnSearch, SIGNAL("clicked()"), self.search)
     lblSearch = MLabel(translate("Searcher", "Search : "))
     lblSearchList = MLabel(translate("Searcher", "Search List : "))
     self.lblSearchListValues = MLabel(str(""))
     self.lblSearchListValues.setWordWrap(True)
     self.leSearch = MLineEdit(str(""))
     self.teSearchResult = MTextEdit()
     self.teSearchResult.setText(str(""))
     self.connect(self.leSearch, SIGNAL("textChanged(const QString&)"),
                  self.searchAfter)
     self.cckbIsRegExp = Options.MyCheckBox(
         self, translate("Searcher", "Regular Expression (RegExp)"), 0,
         "SearcherIsRegExp", self.isRegExpChanged)
     self.cckbIsCaseInsensitive = Options.MyCheckBox(
         self, translate("Searcher", "Case Insensitive"), 2,
         "SearcherIsCaseInsensitive", self.search)
     self.cckbIsNormalizeUTF8Chars = Options.MyCheckBox(
         self, translate("Searcher", "Normalize UTF-8 Characters"), 2,
         "SearcherIsNormalizeUTF8Chars", self.search)
     self.cckbIsClearDigits = Options.MyCheckBox(
         self, translate("Searcher", "Clear Digits"), 2,
         "SearcherIsClearDigits", self.search)
     self.cckbIsOnlyDigitsAndLetters = Options.MyCheckBox(
         self, translate("Searcher", "Only Digits And Letters"), 2,
         "SearcherIsOnlyDigitsAndLetters", self.search)
     self.cckbIsClearVowels = Options.MyCheckBox(
         self, translate("Searcher", "Clear Vowels"), 2,
         "SearcherIsClearVowels", self.search)
     self.cckbIsNormalizeUTF8CharsAndClearVowels = Options.MyCheckBox(
         self,
         translate("Searcher",
                   "Normalize UTF-8 Characters And Clear Vowels"), 2,
         "SearcherIsNormalizeUTF8CharsAndClearVowels", self.search)
     self.cckbIsLineWrap = Options.MyCheckBox(
         self, translate("Searcher", "Wrap By Width"), 0,
         "SearcherIsLineWrap", self.isLineWrap)
     self.pbtnEditValuePathToSeach = MPushButton(translate("Options", "*"))
     self.pbtnEditValuePathToSeach.setObjectName(
         "Edit Values With Advanced Value Editor Path To Seach")
     self.pbtnEditValuePathToSeach.setToolTip(
         translate("Options", "Edit values with Advanced Value Editor"))
     self.pbtnEditValuePathToSeach.setFixedWidth(25)
     MObject.connect(self.pbtnEditValuePathToSeach, SIGNAL("clicked()"),
                     self.pbtnEditValuePathToSeachClicked)
     pnlMain = MWidget(self)
     tabwTabs = MTabWidget()
     vblMain = MVBoxLayout(pnlMain)
     pnlMain2 = MWidget(tabwTabs)
     vblMain2 = MVBoxLayout(pnlMain2)
     HBox = MHBoxLayout()
     HBox.addWidget(self.lePathToSeach)
     HBox.addWidget(self.pbtnEditValuePathToSeach)
     HBox1 = MHBoxLayout()
     HBox1.addWidget(self.pbtnReloadSourceToSearch)
     HBox1.addWidget(self.pbtnSelectSeachDirectoryPath)
     HBox1.addWidget(self.pbtnAddSeachDirectoryPath)
     HBox1.addWidget(self.pbtnSelectSeachFilePath)
     HBox1.addWidget(self.pbtnAddSeachFilePath)
     HBox3 = MHBoxLayout()
     HBox3.addWidget(lblSearch, 1)
     HBox3.addWidget(self.leSearch, 20)
     HBox3.addWidget(self.pbtnSearch, 1)
     HBox2 = MHBoxLayout()
     HBox2.addWidget(self.pbtnClose)
     VBox1 = MVBoxLayout()
     HBox4 = MHBoxLayout()
     HBox4.addWidget(self.cckbIsClearDigits)
     HBox4.addWidget(self.cckbIsOnlyDigitsAndLetters)
     HBox5 = MHBoxLayout()
     HBox5.addWidget(self.cckbIsNormalizeUTF8Chars)
     HBox5.addWidget(self.cckbIsClearVowels)
     HBox6 = MHBoxLayout()
     HBox6.addWidget(self.cckbIsNormalizeUTF8CharsAndClearVowels)
     HBox7 = MHBoxLayout()
     HBox7.addWidget(lblSearchList, 1)
     HBox7.addWidget(self.lblSearchListValues, 20)
     HBox8 = MHBoxLayout()
     HBox8.addWidget(self.cckbIsRegExp)
     HBox8.addWidget(self.cckbIsCaseInsensitive)
     VBox1.addLayout(HBox8)
     VBox1.addLayout(HBox4)
     VBox1.addLayout(HBox5)
     VBox1.addLayout(HBox6)
     vblMain2.addWidget(lblPleaseSelect)
     vblMain2.addLayout(HBox)
     vblMain2.addLayout(HBox1)
     vblMain2.addLayout(HBox3)
     vblMain2.addLayout(HBox7)
     gboxFilters = MGroupBox(translate("Searcher", "Filters : "))
     gboxFilters.setLayout(VBox1)
     vblMain2.addWidget(gboxFilters)
     vblMain2.addWidget(self.teSearchResult, 20)
     vblMain2.addWidget(self.cckbIsLineWrap)
     vblMain2.addStretch(1)
     vblMain2.addLayout(HBox2)
     tabwTabs.addTab(pnlMain2, translate("Searcher", "Search"))
     tabwTabs.addTab(wOptionsPanel, translate("Searcher", "Quick Options"))
     vblMain.addWidget(tabwTabs)
     if MyDialogType == "MDialog":
         if isActivePyKDE4:
             self.setMainWidget(pnlMain)
         else:
             self.setLayout(vblMain)
     elif MyDialogType == "MMainWindow":
         self.setCentralWidget(pnlMain)
         moveToCenter(self)
     self.isRegExpChanged(False)
     self.isLineWrap()
     self.setWindowTitle(translate("Searcher", "Searcher"))
     self.setWindowIcon(MIcon("Images:search.png"))
     self.show()