diff --git a/src/lay/lay/MainConfigPage7.ui b/src/lay/lay/MainConfigPage7.ui
index 6f2b73662..5cc9b7655 100644
--- a/src/lay/lay/MainConfigPage7.ui
+++ b/src/lay/lay/MainConfigPage7.ui
@@ -57,7 +57,7 @@
-
- If this option is enabled, the program will detect changes in layout files and ask whether to reload them
+ If this option is enabled, the program will detect changes in layout files and ask whether to reload them.
true
@@ -109,7 +109,45 @@
-
- (0 for "no backups)
+ (0 for no backups)
+
+
+
+
+
+
+ -
+
+
+ Disable Save Needed Dialog
+
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
+ 9
+
+
-
+
+
+ Always exit without saving
+
+
+
+ -
+
+
+ If this option is enabled, the program will not ask to save changes before exiting.
+
+
+ false
diff --git a/src/lay/lay/layConfig.h b/src/lay/lay/layConfig.h
index f9f3b44fe..488a6f7ee 100644
--- a/src/lay/lay/layConfig.h
+++ b/src/lay/lay/layConfig.h
@@ -62,6 +62,7 @@ static const std::string cfg_window_geometry ("window-geometry");
static const std::string cfg_micron_digits ("digits-micron");
static const std::string cfg_dbu_digits ("digits-dbu");
static const std::string cfg_assistant_bookmarks ("assistant-bookmarks");
+static const std::string cfg_always_exit_without_saving ("always-exit-without-saving");
}
diff --git a/src/lay/lay/layMainConfigPages.cc b/src/lay/lay/layMainConfigPages.cc
index 99a56f20e..af7f0758a 100644
--- a/src/lay/lay/layMainConfigPages.cc
+++ b/src/lay/lay/layMainConfigPages.cc
@@ -84,6 +84,7 @@ public:
options.push_back (std::pair (cfg_dbu_digits, "2"));
options.push_back (std::pair (cfg_reader_options_show_always, "false"));
options.push_back (std::pair (cfg_assistant_bookmarks, ""));
+ options.push_back (std::pair (cfg_always_exit_without_saving, "false"));
}
virtual std::vector > config_pages (QWidget *parent) const
@@ -198,6 +199,10 @@ MainConfigPage7::setup (lay::Dispatcher *root)
int kb = 0;
root->config_get (cfg_keep_backups, kb);
mp_ui->keep_backups->setValue (kb);
+
+ bool ex = false;
+ root->config_get (cfg_always_exit_without_saving, ex);
+ mp_ui->always_exit_without_saving->setChecked (ex);
}
void
@@ -206,6 +211,7 @@ MainConfigPage7::commit (lay::Dispatcher *root)
try {
root->config_set (cfg_layout_file_watcher_enabled, mp_ui->check_for_updates->isChecked ());
root->config_set (cfg_keep_backups, mp_ui->keep_backups->value ());
+ root->config_set (cfg_always_exit_without_saving, mp_ui->always_exit_without_saving->isChecked ());
} catch (...) { }
}
diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc
index 03732fee1..ed5bff7f9 100644
--- a/src/lay/lay/layMainWindow.cc
+++ b/src/lay/lay/layMainWindow.cc
@@ -201,6 +201,8 @@ MainWindow::MainWindow (QApplication *app, const char *name, bool undo_enabled)
init_menu ();
mp_assistant = 0;
+
+ m_always_exit_without_saving = false;
mp_pr = new lay::ProgressReporter ();
mp_pr->set_progress_bar (&m_text_progress);
@@ -1265,6 +1267,11 @@ MainWindow::configure (const std::string &name, const std::string &value)
m_initial_technology = value;
return true;
+ } else if (name == cfg_always_exit_without_saving) {
+
+ tl::from_string (cfg_always_exit_without_saving, m_always_exit_without_saving);
+ return true;
+
} else {
return false;
}
@@ -1477,7 +1484,7 @@ MainWindow::can_close ()
std::string df_list;
int dirty_layouts = dirty_files (df_list);
- if (dirty_layouts == 0) {
+ if ( m_always_exit_without_saving || (dirty_layouts == 0) ) {
return true;
} else {
diff --git a/src/lay/lay/layMainWindow.h b/src/lay/lay/layMainWindow.h
index c1aee7ea6..362894ab2 100644
--- a/src/lay/lay/layMainWindow.h
+++ b/src/lay/lay/layMainWindow.h
@@ -684,7 +684,7 @@ private:
lay::Navigator *mp_navigator;
QDockWidget *mp_hp_dock_widget, *mp_lp_dock_widget, *mp_libs_dock_widget, *mp_eo_dock_widget, *mp_bm_dock_widget;
ControlWidgetStack *mp_hp_stack, *mp_lp_stack, *mp_libs_stack, *mp_eo_stack, *mp_bm_stack;
- bool m_hp_visible, m_lp_visible, m_libs_visible, m_eo_visible, m_bm_visible, m_navigator_visible, m_layer_toolbox_visible;
+ bool m_hp_visible, m_lp_visible, m_libs_visible, m_eo_visible, m_bm_visible, m_navigator_visible, m_layer_toolbox_visible, m_always_exit_without_saving;
QDockWidget *mp_layer_toolbox_dock_widget;
lay::LayerToolbox *mp_layer_toolbox;
ViewWidgetStack *mp_view_stack;
diff --git a/src/lym/lym/lymMacroCollection.cc b/src/lym/lym/lymMacroCollection.cc
index e0e4dd2ce..5f9a1e12c 100644
--- a/src/lym/lym/lymMacroCollection.cc
+++ b/src/lym/lym/lymMacroCollection.cc
@@ -423,7 +423,7 @@ void MacroCollection::scan ()
}
std::vector dirs = tl::dir_entries (p, false /*with_files*/, true /*with_dirs*/, true /*without_dotfiles*/);
- for (auto f = files.begin (); f != files.end (); ++f) {
+ for (auto f = dirs.begin (); f != dirs.end (); ++f) {
std::string fp = tl::combine_path (p, *f);
if (! tl::is_dir (fp)) {
@@ -439,8 +439,8 @@ void MacroCollection::scan ()
mc->set_virtual_mode (NotVirtual);
bool ro = (m_readonly || ! tl::is_writable (fp));
mc->set_readonly (ro);
- mc->scan ();
mc->set_parent (this);
+ mc->scan ();
}
} catch (tl::Exception &ex) {
diff --git a/src/pya/pya/pya.cc b/src/pya/pya/pya.cc
index 45864b955..9a39c7704 100644
--- a/src/pya/pya/pya.cc
+++ b/src/pya/pya/pya.cc
@@ -92,14 +92,27 @@ public:
{
while (frame != NULL) {
+#if PY_VERSION_HEX >= 0x030B0000
+ int line = PyFrame_GetLineNumber(frame);
+#else
int line = frame->f_lineno;
+#endif
std::string fn;
+#if PY_VERSION_HEX >= 0x030B0000
+ if (test_type (PyFrame_GetCode(frame)->co_filename, true)) {
+ fn = normalize_path (python2c (PyFrame_GetCode(frame)->co_filename));
+#else
if (test_type (frame->f_code->co_filename, true)) {
fn = normalize_path (python2c (frame->f_code->co_filename));
+#endif
}
m_stack_trace.push_back (tl::BacktraceElement (fn, line));
+#if PY_VERSION_HEX >= 0x030B0000
+ frame = PyFrame_GetBack(frame);
+#else
frame = frame->f_back;
+#endif
}
}
@@ -444,7 +457,11 @@ PythonInterpreter::get_context (int context, PythonRef &globals, PythonRef &loca
PyFrameObject *f = mp_current_frame;
while (f && context > 0) {
+#if PY_VERSION_HEX >= 0x030B0000
+ f = PyFrame_GetBack(f);
+#else
f = f->f_back;
+#endif
--context;
}
@@ -454,8 +471,13 @@ PythonInterpreter::get_context (int context, PythonRef &globals, PythonRef &loca
// (see PyFrame_GetLocals implementation)
PyFrame_FastToLocals (f);
+#if PY_VERSION_HEX >= 0x030B0000
+ globals = PythonRef (PyObject_GetAttrString((PyObject*)f, "f_globals"));
+ locals = PythonRef (PyObject_GetAttrString((PyObject*)f, "f_locals"), false);
+#else
globals = PythonRef (f->f_globals, false);
locals = PythonRef (f->f_locals, false);
+#endif
} else {
@@ -634,8 +656,13 @@ PythonInterpreter::trace_func (PyFrameObject *frame, int event, PyObject *arg)
// see below for a description of m_block_exceptions
m_block_exceptions = false;
+#if PY_VERSION_HEX >= 0x030B0000
+ int line = PyFrame_GetLineNumber(frame);
+ size_t file_id = prepare_trace (PyFrame_GetCode(frame)->co_filename);
+#else
int line = frame->f_lineno;
size_t file_id = prepare_trace (frame->f_code->co_filename);
+#endif
PythonStackTraceProvider st_provider (frame, m_debugger_scope);
mp_current_exec_handler->trace (this, file_id, line, &st_provider);
@@ -666,8 +693,13 @@ PythonInterpreter::trace_func (PyFrameObject *frame, int event, PyObject *arg)
} else {
+#if PY_VERSION_HEX >= 0x030B0000
+ int line = PyFrame_GetLineNumber(frame);
+ size_t file_id = prepare_trace (PyFrame_GetCode(frame)->co_filename);
+#else
int line = frame->f_lineno;
size_t file_id = prepare_trace (frame->f_code->co_filename);
+#endif
std::string emsg = "";
if (exc_value) {
diff --git a/src/pya/pya/pyaUtils.cc b/src/pya/pya/pyaUtils.cc
index bfb14ac4e..94527b092 100644
--- a/src/pya/pya/pyaUtils.cc
+++ b/src/pya/pya/pyaUtils.cc
@@ -62,7 +62,11 @@ void check_error ()
if (exc_traceback) {
PyTracebackObject *traceback = (PyTracebackObject*) exc_traceback.get ();
for (PyTracebackObject *t = traceback; t; t = t->tb_next) {
+#if PY_VERSION_HEX >= 0x030B0000
+ backtrace.push_back (tl::BacktraceElement (python2c (PyFrame_GetCode(t->tb_frame)->co_filename), t->tb_lineno));
+#else
backtrace.push_back (tl::BacktraceElement (python2c (t->tb_frame->f_code->co_filename), t->tb_lineno));
+#endif
}
std::reverse (backtrace.begin (), backtrace.end ());
}