Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Sourcery refactored master branch #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ def insert(self, key, value):
def getitem(self, key):
return self.MetaVault[key]

def toFormat(format = ["Json", "Raw String"]):
def toFormat(self):
Copy link
Author

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:

...

16 changes: 6 additions & 10 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Compressor.__init__ refactored with the following changes:


def Compress(self,compression_destination: os.path, compress_method = ["DEFLATED", "BZIP2", "LZMA"]):
"""Comprime un archivo en distintos metodos de compresion.\n
Expand Down Expand Up @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Notepad.saveToFile refactored with the following changes:

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)
Expand All @@ -343,8 +341,6 @@ def clearText(self):

if answer == QMessageBox.Yes:
self.text_field.clear()
else:
pass
Comment on lines -346 to -347
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Notepad.clearText refactored with the following changes:


def findTextDialog(self):
"""
Expand All @@ -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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Notepad.findTextDialog refactored with the following changes:

#* Buscamos mas ocurriencias en el texto
while(self.text_field.find(find_text)):
#* Usamos ExtraSelection para guardar de color amarillo
Expand Down