-
Notifications
You must be signed in to change notification settings - Fork 0
Sourcery refactored master branch #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ def __init__(self, path: os.path, system = ["Mac", "Windows", "Linux"]): | |
try: | ||
self.path: os.path = path | ||
except os.error: | ||
return f"El parametro 'path' no posee un formato valido. Proporciona una ruta de sistema" | ||
return "El parametro 'path' no posee un formato valido. Proporciona una ruta de sistema" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def Compress(self,compression_destination: os.path, compress_method = ["DEFLATED", "BZIP2", "LZMA"]): | ||
"""Comprime un archivo en distintos metodos de compresion.\n | ||
|
@@ -298,33 +298,31 @@ def saveToFile(self): | |
|
||
file_name,_ =QFileDialog.getSaveFileName(self,'Guardar Archivo', | ||
"Untitled - BNotePad" if not self.FileOpened[0] else self.FileOpened[1], initialFilter= ffilter if ffilter else "Text Files(*.txt)" ,filter="HTML Files(*.html);;Text Files(*.txt);;MarkDown Files(*.md);;Python Files(*.py)") | ||
|
||
if _ and file_name: | ||
|
||
Comment on lines
-301
to
+303
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
if file_name.endswith('.html'): | ||
notepad_richtext= self.text_field.toHtml() | ||
with open(file_name,'w') as f: | ||
f.write(notepad_richtext) | ||
with open(file_name, "a") as f: | ||
f.write(f"\n\n\n{bmark}") | ||
f.close() | ||
QMessageBox.information(self, "Guardado de archivos", f"El archivo {file_name} se ha guardado correctamente", buttons= QMessageBox.Ok) | ||
elif file_name.endswith('.md'): | ||
notepad_richtext= self.text_field.toMarkdown() | ||
with open(file_name,'w') as f: | ||
f.write(notepad_richtext) | ||
with open(file_name, "a") as f: | ||
f.write(f"\n\n\n{bmark}") | ||
f.close() | ||
QMessageBox.information(self, "Guardado de archivos", f"El archivo {file_name} se ha guardado correctamente", buttons= QMessageBox.Ok) | ||
else: | ||
notepad_text= self.text_field.toPlainText() | ||
with open(file_name,'w') as f: | ||
f.write(notepad_text) | ||
with open(file_name, "a") as f: | ||
f.write(f"\n\n\n{bmark}") | ||
f.close() | ||
QMessageBox.information(self, "Guardado de archivos", f"El archivo {file_name} se ha guardado correctamente", buttons= QMessageBox.Ok) | ||
QMessageBox.information(self, "Guardado de archivos", f"El archivo {file_name} se ha guardado correctamente", buttons= QMessageBox.Ok) | ||
else: | ||
QMessageBox.information(self,"Save Error", | ||
"No ha sido posible guardar el archivo o se ha rechazado la operacion", QMessageBox.Ok) | ||
|
@@ -343,8 +341,6 @@ def clearText(self): | |
|
||
if answer == QMessageBox.Yes: | ||
self.text_field.clear() | ||
else: | ||
pass | ||
Comment on lines
-346
to
-347
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def findTextDialog(self): | ||
""" | ||
|
@@ -353,13 +349,13 @@ def findTextDialog(self): | |
|
||
#* Mostramos un cuadro de dialogo de entrada para obtener la palabra con la que empezar a buscar | ||
find_text,ok= QInputDialog.getText(self,"Buscar Texto","Find:") | ||
extra_selections=[] | ||
|
||
#*Aseguramos que el texto se pueda modificar | ||
if ok and not self.text_field.isReadOnly(): | ||
#*Mueve el cursor al principio del texto | ||
self.text_field.moveCursor(QTextCursor.Start) | ||
color= QColor(Qt.yellow) | ||
extra_selections=[] | ||
|
||
Comment on lines
-356
to
+358
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
#* Buscamos mas ocurriencias en el texto | ||
while(self.text_field.find(find_text)): | ||
#* Usamos ExtraSelection para guardar de color amarillo | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
DataVault.toFormat
refactored with the following changes:self
(instance-method-first-arg-name
)