Disable menu options on json load
This commit is contained in:
parent
7794bbfb3f
commit
9510c444c9
@ -170,6 +170,7 @@ int CommandHandler::executeMain(std::unique_ptr<Context> ctx)
|
||||
log_error("Loading design failed.\n");
|
||||
|
||||
customAfterLoad(w.getContext());
|
||||
w.updateJsonLoaded();
|
||||
}
|
||||
} catch (log_execution_error_exception) {
|
||||
// show error is handled by gui itself
|
||||
|
@ -302,8 +302,7 @@ void BaseMainWindow::load_json(std::string filename)
|
||||
if (parse_json_file(f, filename, ctx.get())) {
|
||||
log("Loading design successful.\n");
|
||||
Q_EMIT updateTreeView();
|
||||
actionPack->setEnabled(true);
|
||||
onJsonLoaded();
|
||||
updateJsonLoaded();
|
||||
} else {
|
||||
actionLoadJSON->setEnabled(true);
|
||||
log("Loading design failed.\n");
|
||||
@ -425,4 +424,11 @@ void BaseMainWindow::disableActions()
|
||||
onDisableActions();
|
||||
}
|
||||
|
||||
void BaseMainWindow::updateJsonLoaded()
|
||||
{
|
||||
disableActions();
|
||||
actionPack->setEnabled(true);
|
||||
onJsonLoaded();
|
||||
}
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
@ -48,12 +48,12 @@ class BaseMainWindow : public QMainWindow
|
||||
explicit BaseMainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent = 0);
|
||||
virtual ~BaseMainWindow();
|
||||
Context *getContext() { return ctx.get(); }
|
||||
|
||||
void load_json(std::string filename);
|
||||
|
||||
void updateJsonLoaded();
|
||||
protected:
|
||||
void createMenusAndBars();
|
||||
void disableActions();
|
||||
void load_json(std::string filename);
|
||||
|
||||
virtual void onDisableActions(){};
|
||||
virtual void onJsonLoaded(){};
|
||||
virtual void onPackFinished(){};
|
||||
|
@ -34,9 +34,10 @@ class MainWindow : public BaseMainWindow
|
||||
|
||||
public:
|
||||
void createMenu();
|
||||
void load_pcf(std::string filename);
|
||||
|
||||
protected:
|
||||
void load_pcf(std::string filename);
|
||||
|
||||
void onDisableActions() override;
|
||||
void onJsonLoaded() override;
|
||||
void onRouteFinished() override;
|
||||
|
Loading…
Reference in New Issue
Block a user