make few publisher attributes and methods public

This commit is contained in:
Mustafa-Zarkash 2023-09-15 17:02:49 +03:00
parent e48090757f
commit 2f5494cc76
3 changed files with 39 additions and 21 deletions

View file

@ -388,6 +388,20 @@ class PublisherWindow(QtWidgets.QDialog):
def controller(self):
return self._controller
@property
def reset_on_show(self):
return self._reset_on_show
@reset_on_show.setter
def reset_on_show(self, value):
self._reset_on_show = value
def set_comment_input_text(self, text=""):
self._comment_input.setText(text)
def click_publish(self):
self._on_publish_clicked()
def make_sure_is_visible(self):
if self._window_is_visible:
self.setWindowState(QtCore.Qt.WindowActive)

View file

@ -261,7 +261,7 @@ class HostToolsHelper:
dialog.activateWindow()
dialog.showNormal()
def get_publisher_tool(self, parent=None, controller=None):
def get_publisher_tool(self, parent=None, controller=None, reset_on_show=None):
"""Create, cache and return publisher window."""
if self._publisher_tool is None:
@ -271,15 +271,19 @@ class HostToolsHelper:
ILoadHost.validate_load_methods(host)
publisher_window = PublisherWindow(
controller=controller, parent=parent or self._parent
controller=controller,
parent=parent or self._parent,
reset_on_show=reset_on_show
)
self._publisher_tool = publisher_window
return self._publisher_tool
def show_publisher_tool(self, parent=None, controller=None, tab=None):
def show_publisher_tool(
self, parent=None, controller=None, reset_on_show=None, tab=None
):
with qt_app_context():
window = self.get_publisher_tool(parent, controller)
window = self.get_publisher_tool(parent, controller, reset_on_show)
if tab:
window.set_current_tab(tab)
window.make_sure_is_visible()