Skip to content

Commit

Permalink
Version 6.6
Browse files Browse the repository at this point in the history
- added new custom yes/no dialogs
- bug fixes
  • Loading branch information
Matic Kukovec committed Jul 7, 2017
1 parent 4f4e48b commit b90f8a8
Show file tree
Hide file tree
Showing 10 changed files with 370 additions and 88 deletions.
6 changes: 5 additions & 1 deletion components.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ def update_styles():
TheSquid.customize_menu_style(TheSquid.main_form.menubar)
TheSquid.customize_menu_style(TheSquid.main_form.sessions_menu)
TheSquid.customize_menu_style(TheSquid.main_form.recent_files_menu)
TheSquid.customize_menu_style(TheSquid.main_form.save_in_encoding)

def set_style(menu):
if hasattr(menu, "actions"):
Expand All @@ -425,7 +426,6 @@ def set_style(menu):

for window in windows:
window.customize_tab_bar()
TheSquid.customize_menu_style(window.custom_tab_bar)

for i in range(window.count()):
if hasattr(window.widget(i), "corner_widget"):
Expand All @@ -448,6 +448,7 @@ def set_style(menu):
@staticmethod
def customize_menu_style(menu):
if data.custom_menu_scale != None and data.custom_menu_font != None:
# Customize the style
try:
default_style_name = data.QApplication.style().objectName()
custom_style = CustomStyle(default_style_name)
Expand All @@ -459,6 +460,9 @@ def customize_menu_style(menu):
else:
custom_style = CustomStyle("GTK")
menu.setStyle(custom_style)
else:
# Reset the style
menu.setStyle(data.QApplication.style())



Expand Down
2 changes: 1 addition & 1 deletion data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"QLabel", "QAction", "QGridLayout", "QStatusBar", "QVBoxLayout",
"QSplitter", "QToolButton", "QToolBar", "QAbstractItemView", "QMessageBox",
"QFileDialog", "QTextEdit", "QWidget", "QCommonStyle", "QStyleFactory",
"QStyle", "QMessageBox",
"QStyle", "QMessageBox", "QDesktopWidget",
]

try:
Expand Down
83 changes: 11 additions & 72 deletions forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,7 @@ def closeEvent(self, event):
#Check if there are any modified documents
if self.check_document_states() == True:
quit_message = "You have modified documents!\nQuit anyway?"
reply = data.QMessageBox.question(
self,
'Quit',
quit_message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(quit_message)
if reply != data.QMessageBox.Yes:
event.ignore()

Expand Down Expand Up @@ -574,7 +568,6 @@ def _init_menubar(self):
This is a very long function that should be trimmed sometime!
"""
self.menubar = data.QMenuBar(self)
# components.TheSquid.customize_menu_style(self.menubar)
# Click filter for the menubar menus
click_filter = components.ActionFilter(self)
# Nested function for creating an action
Expand Down Expand Up @@ -698,13 +691,7 @@ def open_user_func_file():
message_type=data.MessageType.ERROR
)
message = "Do you wish to generate the default user definition and function file?"
reply = data.QMessageBox.question(
self,
'Generate default configuration file',
message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(message)
if reply == data.QMessageBox.Yes:
functions.create_default_config_file()
self.display.repl_display_message(
Expand Down Expand Up @@ -2071,13 +2058,7 @@ def import_user_functions(self):
message_type=data.MessageType.ERROR
)
message = "Do you wish to generate the default user definition and function file?"
reply = data.QMessageBox.question(
self,
'Generate default configuration file',
message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(message)
if reply == data.QMessageBox.Yes:
functions.create_default_config_file()
self.display.repl_display_message(
Expand Down Expand Up @@ -2203,13 +2184,7 @@ def open_file_function(in_file, basic_widget):
warning += "A lot of RAM will be needed!\n"
warning += "Files larger than 300 MB can cause the system to hang!\n"
warning += "Are you sure you want to open it?"
reply = data.QMessageBox.question(
self,
'OPENING HUGE FILE',
warning,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.warning(warning)
if reply == data.QMessageBox.No:
return
#Check selected window
Expand Down Expand Up @@ -2311,13 +2286,7 @@ def close_all_tabs(self):
#Close the log window if it is displayed
self.view.set_log_window(False)
message = "You have modified documents!\nClose all tabs?"
reply = data.QMessageBox.question(
self,
'Close all tabs',
message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(message)
if reply == data.QMessageBox.No:
return
#Close all tabs and remove all bookmarks from them
Expand Down Expand Up @@ -2662,13 +2631,7 @@ def restore(self, session_name, session_group=None):
self.parent.view.set_log_window(False)
message = "You have modified documents!\n"
message += "Restore session '{:s}' anyway?".format(session_name)
reply = data.QMessageBox.question(
self.parent,
'Restore Session',
message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(message)
if reply == data.QMessageBox.No:
return
#Find the session
Expand Down Expand Up @@ -2719,12 +2682,7 @@ def exco_restore(self):
self.parent.view.set_log_window(False)
message = "You have modified documents!\n"
message += "Restore Ex.Co development session anyway?"
reply = data.QMessageBox.question(
self.parent, 'Restore Session',
message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(message)
if reply == data.QMessageBox.No:
return
#Clear all documents from the main and upper window
Expand Down Expand Up @@ -3690,13 +3648,7 @@ def replace_in_files(self,
warning += "You better have a backup of the files if you are unsure,\n"
warning += "because this action CANNOT be undone!\n"
warning += "Do you want to continue?"
reply = data.QMessageBoxwarning(
self.parent,
'REPLACING IN FILES',
warning,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.warning(warning)
if reply == data.QMessageBox.No:
return
#Check if the search directory is none, then use a dialog window
Expand Down Expand Up @@ -5708,6 +5660,7 @@ def add_diff_actions():
self.addSeparator()
add_diff_actions()


# Class variables
# Name of the basic widget
name = ""
Expand Down Expand Up @@ -5754,8 +5707,6 @@ def __init__(self, parent):
# Store the default settings
self.default_tab_font = self.tabBar().font()
self.default_icon_size = self.tabBar().iconSize()
# Customize the style as needed
# self.customize_tab_bar()

def customize_tab_bar(self):
if data.custom_menu_scale != None and data.custom_menu_font != None:
Expand Down Expand Up @@ -5952,13 +5903,7 @@ def clear_document_bookmarks():
#Display the close notification
close_message = "Document '" + self.tabText(emmited_tab_number)
close_message += "' has been modified!\nClose it anyway?"
reply = data.QMessageBox.question(
self,
'Closing Tab',
close_message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(close_message)
if reply == data.QMessageBox.Yes:
clear_document_bookmarks()
#Close tab anyway
Expand Down Expand Up @@ -8458,13 +8403,7 @@ def reload_file(self):
self.main_form.view.set_log_window(False)
#Display the close notification
reload_message = "Document '" + self.name+ "' has been modified!\nReload it from disk anyway?"
reply = data.QMessageBox.question(
self,
'Reloding Tab',
reload_message,
data.QMessageBox.Yes,
data.QMessageBox.No
)
reply = helper_forms.YesNoDialog.question(reload_message)
if reply == data.QMessageBox.No:
#Cancel tab file reloading
return
Expand Down
Loading

0 comments on commit b90f8a8

Please sign in to comment.