Data.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. include("scripts/EAction.js");
  2. /**
  3. * \class Data
  4. * \brief Base class for all Data menu entries.
  5. * \ingroup ecma_Data
  6. */
  7. function Data(guiAction) {
  8. EAction.call(this, guiAction);
  9. }
  10. Data.prototype = new EAction();
  11. Data.includeBasePath = includeBasePath;
  12. Data.openUrl = function(url) {
  13. QDesktopServices.openUrl(new QUrl(url));
  14. };
  15. Data.getMenu = function() {
  16. var menu = EAction.getMenu(Data.getTitle(), "DataMenu");
  17. menu.setProperty("scriptFile", Data.includeBasePath + "/Data.js");
  18. return menu;
  19. };
  20. Data.getToolBar = function() {
  21. var tb = EAction.getToolBar(Data.getTitle(), "DataToolBar");
  22. // if (tb.property("Initialized")!==true) {
  23. // tb.visible = false;
  24. // }
  25. return tb;
  26. };
  27. Data.getCadToolBarPanel = function() {
  28. var mtb = EAction.getMainCadToolBarPanel();
  29. var actionName = "DataToolsPanelAction";
  30. if (!isNull(mtb) && mtb.findChild(actionName)==undefined) {
  31. var action = new RGuiAction(qsTr("Data Tools"), mtb);
  32. action.setScriptFile(Data.includeBasePath + "/Data.js");
  33. action.objectName = actionName;
  34. action.setRequiresDocument(true);
  35. // action.setIcon(Data.includeBasePath + "/Data.svg");
  36. //action.setStatusTip(qsTr("Show layer tools"));
  37. action.setDefaultShortcut(new QKeySequence("w,y"));
  38. action.setNoState();
  39. action.setDefaultCommands(["DataMenu"]);
  40. action.setGroupSortOrder(10);
  41. action.setSortOrder(101);
  42. action.setWidgetNames(["!MainToolsPanel"]);
  43. }
  44. var tb = EAction.getCadToolBarPanel(
  45. Data.getTitle(),
  46. "DataToolsPanel",
  47. true
  48. );
  49. return tb;
  50. };
  51. Data.getToolMatrixPanel = function() {
  52. RSettings.setValue("Data/VisibleInMatrixPanel", false, false);
  53. return EAction.getToolMatrixPanel(Data.getTitle(), "DataMatrixPanel", 1000);
  54. };
  55. Data.getTitle = function() {
  56. return qsTr("&数据");
  57. };
  58. Data.prototype.getTitle = function() {
  59. return Data.getTitle();
  60. };
  61. Data.init = function() {
  62. Data.getMenu();
  63. Data.getToolBar();
  64. Data.getCadToolBarPanel();
  65. Data.getToolMatrixPanel();
  66. };