Skip to content

Commit

Permalink
make app open second instance of excel and make it invisible after op…
Browse files Browse the repository at this point in the history
…ening the file to use
  • Loading branch information
ntaraujo committed Feb 8, 2022
1 parent b6d55ec commit 3f33ac0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/automators/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,33 @@

sys_path.insert(0, local_resource_path(""))

from utils import msg
from utils import compiled, msg


class Excel:
def __init__(self):
self.macros_file = None
self.file = None
self.path = None

@staticmethod
def aditional_app():
import xlwings as xw

if xw.apps.count < 2:
msg("Iniciando nova instância do Excel")
new_app = xw.App()
new_app.activate()
new_app.visible = True

def open_macros(self):
msg("Abrindo macros")

import xlwings as xw

self.aditional_app()
self.macros_file = xw.Book(local_resource_path("automators/macros-trendy.xlsb"))
self.macros_file.activate()

def open(self, path=None):
if path is None:
Expand All @@ -35,6 +47,7 @@ def open(self, path=None):
self.path = path

self.file.activate()
self.file.app.visible = not compiled()

def close(self):
if self.path is not None:
Expand Down

0 comments on commit 3f33ac0

Please sign in to comment.