forked from 1b-agent/opencadstudio-upstream
NEW: open the template picker in the default template's folder
Refs #1836 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0a968a0509
commit
4158fda45c
1 file changed
+13
-2
@@ -9,9 +9,20 @@ impl OpenCADStudio {
|
|||||||
// asks which template to start from (#1635).
|
// asks which template to start from (#1635).
|
||||||
"QNEW" => return Some(Task::done(Message::TabNew)),
|
"QNEW" => return Some(Task::done(Message::TabNew)),
|
||||||
"NEW" => {
|
"NEW" => {
|
||||||
|
// Open where the default template lives, so its neighbours in
|
||||||
|
// a template folder are one click away (#1836).
|
||||||
|
let template_dir = std::path::Path::new(self.qnew_template.trim())
|
||||||
|
.parent()
|
||||||
|
.filter(|dir| dir.is_dir())
|
||||||
|
.map(std::path::Path::to_path_buf);
|
||||||
return Some(Task::perform(
|
return Some(Task::perform(
|
||||||
async {
|
async move {
|
||||||
crate::sys::file_dialog()
|
let dialog = crate::sys::file_dialog();
|
||||||
|
let dialog = match template_dir {
|
||||||
|
Some(dir) => dialog.set_directory(dir),
|
||||||
|
None => dialog,
|
||||||
|
};
|
||||||
|
dialog
|
||||||
.set_title(crate::t!("Select Template").as_ref())
|
.set_title(crate::t!("Select Template").as_ref())
|
||||||
.add_filter(
|
.add_filter(
|
||||||
crate::t!("Drawing Template (*.dwt)").as_ref(),
|
crate::t!("Drawing Template (*.dwt)").as_ref(),
|
||||||
|
|||||||
Reference in new issue
Block a user