def destinationClicked(self): imagePath = Dialogs.getSaveFileName(translate("ImageDetails", "Save As"), self.lePathOfDestination.text(), str( translate("ImageDetails", "Images (*.%s)") % uni.getStringFromList(uni.getListValue("imageExtensions"), " *.")), 0) if imagePath is not None: self.lePathOfDestination.setText(imagePath)
def sourceClicked(self): imagePath = Dialogs.getOpenFileName( translate("ImageDetails", "Choose Image"), self.lePathOfSource.text(), str(translate("ImageDetails", "Images (*.%s)")) % uni.getStringFromList(uni.getListValue("imageExtensions"), " *."), 0) if imagePath is not None: self.lePathOfSource.setText(imagePath)
def destinationClicked(self): imagePath = Dialogs.getSaveFileName( translate("ImageDetails", "Save As"), self.lePathOfDestination.text(), str( translate("ImageDetails", "Images (*.%s)") % uni.getStringFromList(uni.getListValue("imageExtensions"), " *.")), 0) if imagePath is not None: self.lePathOfDestination.setText(imagePath)
def selectSearchFilePath(self): try: lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1] SearchPaths = Dialogs.getOpenFileNames(translate("Searcher", "Please Select A Text File To Search"), lastPath, translate("Searcher", "All Files (*.*)")) if SearchPaths is not None: self.lePathToSeach.setText(uni.getStringFromList(SearchPaths, ";")) if self.setSourceToSearch(True, True): self.search() except: ReportBug.ReportBug()
def addSearchDirectoryPath(self): try: lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1] SearchPath = Dialogs.getExistingDirectory(translate("Searcher", "Please Select Directory To Search"), lastPath) if SearchPath is not None: SearchPaths = uni.getListFromListString(self.lePathToSeach.text(), ";") SearchPaths.append(SearchPath) self.lePathToSeach.setText(uni.getStringFromList(SearchPaths, ";")) if self.setSourceToSearch(True, True): self.search() except: ReportBug.ReportBug()
def selectSearchFilePath(self): try: lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1] SearchPaths = Dialogs.getOpenFileNames( translate("Searcher", "Please Select A Text File To Search"), lastPath, translate("Searcher", "All Files (*.*)")) if SearchPaths is not None: self.lePathToSeach.setText( uni.getStringFromList(SearchPaths, ";")) if self.setSourceToSearch(True, True): self.search() except: ReportBug.ReportBug()
def addSearchDirectoryPath(self): try: lastPath = uni.getListFromListString(self.lePathToSeach.text(), ";")[-1] SearchPath = Dialogs.getExistingDirectory( translate("Searcher", "Please Select Directory To Search"), lastPath) if SearchPath is not None: SearchPaths = uni.getListFromListString( self.lePathToSeach.text(), ";") SearchPaths.append(SearchPath) self.lePathToSeach.setText( uni.getStringFromList(SearchPaths, ";")) if self.setSourceToSearch(True, True): self.search() except: ReportBug.ReportBug()
def sourceClicked(self): imagePath = Dialogs.getOpenFileName(translate("ImageDetails", "Choose Image"), self.lePathOfSource.text(), str(translate("ImageDetails", "Images (*.%s)")) % uni.getStringFromList( uni.getListValue("imageExtensions"), " *."), 0) if imagePath is not None: self.lePathOfSource.setText(imagePath)
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()
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()