Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saving asterisk (*) #40

Open
wants to merge 2 commits into
base: noetic-devel
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
26 changes: 19 additions & 7 deletions frame_editor/src/frame_editor/project_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ def open(self):
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.Yes)
if choice == QtWidgets.QMessageBox.Yes:
self.load_file(file_name)
# trigger asterisk (content actually changed)
self.clean_changed(False)
else:
self.load_file("")
self.load_file(file_name)
Expand Down Expand Up @@ -197,27 +199,37 @@ def save_file(self, file_name):
def write_file(self, file_name):
raise NotImplementedError

def update_current_filename(self):
## Set clean
self.editor.undo_stack.setClean()
self.widget.setWindowModified(False)

def get_shown_name(self):
file_name = self.editor.get_file_name()

## Window title
shown_name = "Untitled"
if not file_name == "":
shown_name = file_name
# recent files...

return shown_name

self.widget.lab_file_name.setText(self.tr('{} [*] - {}'.format(shown_name, "frame editor")))
def update_current_filename(self):
## Set clean
self.editor.undo_stack.setClean()
self.widget.setWindowModified(False)

## Window title
shown_name = self.get_shown_name()

self.widget.lab_file_name.setText(self.tr('{} - {}'.format(shown_name, "frame editor")))

def stripped_name(self, full_name):
return QtCore.QFileInfo(full_name).fileName()

def clean_changed(self, is_clean):
self.widget.setWindowModified(not is_clean)

# set file name label
modified_identifier = "*" if self.widget.isWindowModified else ""
shown_name = self.get_shown_name()
self.widget.lab_file_name.setText(self.tr('{}{} - {}'.format(shown_name, modified_identifier, "frame editor")))



## PLUGIN ##
Expand Down
4 changes: 3 additions & 1 deletion frame_editor/src/frame_editor/rqt_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ def update(self, editor, level, elements):

@Slot(int)
def update_all(self, level):
if level & 0:
self.update_current_filename()

## Update list widgets
if level & 1:
self.update_frame_list()
self.update_tf_list()
self.update_current_filename()

## Update the currently selected frame
if level & 2:
Expand Down