mirror of https://github.com/KLayout/klayout.git
Merge remote-tracking branch 'origin/master' into master-mac-qt6
This commit is contained in:
commit
c307c299ed
|
|
@ -57,7 +57,7 @@
|
|||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>If this option is enabled, the program will detect changes in layout files and ask whether to reload them</string>
|
||||
<string>If this option is enabled, the program will detect changes in layout files and ask whether to reload them.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
|
@ -109,7 +109,45 @@
|
|||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>(0 for "no backups)</string>
|
||||
<string>(0 for no backups)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Disable Save Needed Dialog</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="always_exit_without_saving">
|
||||
<property name="text">
|
||||
<string>Always exit without saving</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>If this option is enabled, the program will not ask to save changes before exiting.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ public:
|
|||
options.push_back (std::pair<std::string, std::string> (cfg_dbu_digits, "2"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_reader_options_show_always, "false"));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_assistant_bookmarks, ""));
|
||||
options.push_back (std::pair<std::string, std::string> (cfg_always_exit_without_saving, "false"));
|
||||
}
|
||||
|
||||
virtual std::vector<std::pair <std::string, ConfigPage *> > 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 (...) { }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ void MacroCollection::scan ()
|
|||
}
|
||||
|
||||
std::vector<std::string> 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) {
|
||||
|
|
|
|||
|
|
@ -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<std::string> (PyFrame_GetCode(frame)->co_filename, true)) {
|
||||
fn = normalize_path (python2c<std::string> (PyFrame_GetCode(frame)->co_filename));
|
||||
#else
|
||||
if (test_type<std::string> (frame->f_code->co_filename, true)) {
|
||||
fn = normalize_path (python2c<std::string> (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 = "<unknown>";
|
||||
if (exc_value) {
|
||||
|
|
|
|||
|
|
@ -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<std::string> (PyFrame_GetCode(t->tb_frame)->co_filename), t->tb_lineno));
|
||||
#else
|
||||
backtrace.push_back (tl::BacktraceElement (python2c<std::string> (t->tb_frame->f_code->co_filename), t->tb_lineno));
|
||||
#endif
|
||||
}
|
||||
std::reverse (backtrace.begin (), backtrace.end ());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue