Skip to content

Commit

Permalink
Merge pull request #17 from viniciusccosta/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
viniciusccosta authored Jun 1, 2023
2 parents fbac28c + 44afd68 commit d70f114
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
23 changes: 9 additions & 14 deletions app.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ class MainWindow:

self.f1 = tk.Frame(self.root, )
self.f1.grid(row=1, column=0, padx=5, pady=(0, 10), sticky="nswe")
self.root.columnconfigure(index=0, weight=0, minsize=410)

self.f2 = tk.Frame(self.root, )
self.f2.grid(row=1, column=1, columnspan=2, padx=5, pady=(0, 15), sticky="nswe")

self.f2 = tk.Frame(self.root)
self.f2.grid(row=1, column=1, padx=5, pady=(0, 15), sticky="nswe")
self.root.columnconfigure(index=1, weight=1)

self.root.rowconfigure(index=1, weight=1)

# -------------------------------------
Expand All @@ -64,18 +65,12 @@ class MainWindow:
self.listbox.bind("<Down>", self._on_arrow_down_click)
self.listbox.bind("<Up>", self._on_arrow_up_click)
self.listbox.bind("<Delete>", self._on_del_click)
self.listbox.grid(sticky="nsew", )
self.listbox.pack(fill="both", expand=True)

self.leituras = None
self.cur_index = None
self._fill_list()

cols, rows = self.f1.grid_size()
for r in range(rows):
self.f1.rowconfigure(index=r, weight=1)
for c in range(cols):
self.f1.columnconfigure(index=c, weight=1)

# -------------------------------------
# Detail Frame:
self.canvas = tk.Label(self.f2, bg="gray")
Expand Down Expand Up @@ -216,7 +211,7 @@ class MainWindow:
leitura = self.leituras[selected_index]
delete_leitura(leitura)
self._fill_list()
# TODO: Selecionar algum item da listbox (o anterior, o próximo, o primeiro...)
self.clear()
else:
messagebox.showerror("Erro", "Não foi possível excluir o registro")

Expand Down Expand Up @@ -289,7 +284,7 @@ class MainWindow:
self.update_canvas(filename=os.path.join(HISTORY_PATH, f"{leitura.mili}.png"))
self.update_widget_data(leitura.data)
self.update_tipo(leitura.get_type_display())
self.update_wdiget_leitura(leitura.cod_conv)
self.update_widget_leitura(leitura.cod_conv)
self.update_widget_descricao(leitura.descricao)

def update_tipo(self, tipo:str, *args, **kwargs):
Expand All @@ -311,7 +306,7 @@ class MainWindow:
else:
self.lbl_date.set('')

def update_wdiget_leitura(self, new_text:str, *args, **kwargs):
def update_widget_leitura(self, new_text:str, *args, **kwargs):
"""Insere um valor no widget "Leitura".
Args:
Expand Down Expand Up @@ -387,7 +382,7 @@ class MainWindow:
self.update_canvas()
self.update_widget_data()
self.update_tipo('')
self.update_wdiget_leitura('')
self.update_widget_leitura('')

# ======================================================================================================================
def initial_config():
Expand Down
1 change: 1 addition & 0 deletions app.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ exe = EXE(
strip=False,
upx=True,
console=False,
windowed=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define MyAppName "ClipBarcode"
#define MyAppVersion "1.5.0"
#define MyOutputBaseFilename "clipbarcode_v1.5.0_win64"
#define MyAppVersion "1.6.0"
#define MyOutputBaseFilename "clipbarcode_v1.6.0_win64"
#define MyAppPublisher "Vinícius Costa"
#define MyAppURL "https://github.com/viniciusccosta"
#define MyAppExeName "ClipBarcode.exe"
Expand Down Expand Up @@ -54,10 +54,24 @@ SetupWindowTitle = {#MyAppName} {#MyAppVersion}
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: Integer;
TesseractInstalled: Boolean;
VCRedistInstalled: Boolean;
begin
ExtractTemporaryFile('tesseract-ocr-w64-setup-v5.2.0.20220712.exe');
Exec(ExpandConstant('{tmp}\tesseract-ocr-w64-setup-v5.2.0.20220712.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
// Check if Tesseract OCR is installed
TesseractInstalled := RegKeyExists(HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Tesseract-OCR');
ExtractTemporaryFile('vcredist_x64.exe');
Exec(ExpandConstant('{tmp}\vcredist_x64.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
// Check if VCRedist is installed
VCRedistInstalled := RegKeyExists(HKLM64, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{010792BA-551A-3AC0-A7EF-0FAB4156C382}');
if not TesseractInstalled then
begin
ExtractTemporaryFile('tesseract-ocr-w64-setup-v5.2.0.20220712.exe');
Exec(ExpandConstant('{tmp}\tesseract-ocr-w64-setup-v5.2.0.20220712.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
if not VCRedistInstalled then
begin
ExtractTemporaryFile('vcredist_x64.exe');
Exec(ExpandConstant('{tmp}\vcredist_x64.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
end;
end;
10 changes: 3 additions & 7 deletions database.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ def get_type_display(self,):
return dict(self.TYPES)[self.type]

def __str__(self):
max_len = 10
max_len = 32
campo = self.descricao if self.descricao else self.cod_lido

if self.descricao:
texto = f'{self.id}): {self.descricao[0:max_len]} {"..." if len(self.descricao) > max_len else ""}'
else:
texto = f'{self.id}): |({self.cod_lido[0:max_len]})|'

return texto
return f'{self.id}): {campo[0:max_len]}{"..." if len(campo) > max_len else ""}'

# =====================================================================
def create_tables():
Expand Down

0 comments on commit d70f114

Please sign in to comment.