Interaction.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. include("scripts/EAction.js");
  2. /**
  3. * \class Interaction
  4. * \brief Base class for all Interaction menu entries.
  5. * \ingroup ecma_Interaction
  6. */
  7. function Interaction(guiAction) {
  8. EAction.call(this, guiAction);
  9. }
  10. Interaction.prototype = new EAction();
  11. Interaction.includeBasePath = includeBasePath;
  12. Interaction.openUrl = function(url) {
  13. QDesktopServices.openUrl(new QUrl(url));
  14. };
  15. Interaction.getMenu = function() {
  16. var menu = EAction.getMenu(Interaction.getTitle(), "InteractionMenu");
  17. menu.setProperty("scriptFile", Interaction.includeBasePath + "/Interaction.js");
  18. return menu;
  19. };
  20. Interaction.getToolBar = function() {
  21. var tb = EAction.getToolBar(Interaction.getTitle(), "InteractionToolBar");
  22. // if (tb.property("Initialized")!==true) {
  23. // tb.visible = false;
  24. // }
  25. return tb;
  26. };
  27. Interaction.getCadToolBarPanel = function() {
  28. var mtb = EAction.getMainCadToolBarPanel();
  29. var actionName = "InteractionToolsPanelAction";
  30. if (!isNull(mtb) && mtb.findChild(actionName)==undefined) {
  31. var action = new RGuiAction(qsTr("Interaction Tools"), mtb);
  32. action.setScriptFile(Interaction.includeBasePath + "/Interaction.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(["InteractionMenu"]);
  40. action.setGroupSortOrder(20);
  41. action.setSortOrder(101);
  42. action.setWidgetNames(["!MainToolsPanel"]);
  43. }
  44. var tb = EAction.getCadToolBarPanel(
  45. Interaction.getTitle(),
  46. "InteractionToolsPanel",
  47. true
  48. );
  49. return tb;
  50. };
  51. Interaction.getToolMatrixPanel = function() {
  52. RSettings.setValue("Interaction/VisibleInMatrixPanel", false, false);
  53. return EAction.getToolMatrixPanel(Interaction.getTitle(), "InteractionMatrixPanel", 2000);
  54. };
  55. Interaction.getTitle = function() {
  56. return qsTr("&交互设计");
  57. };
  58. Interaction.prototype.getTitle = function() {
  59. return Interaction.getTitle();
  60. };
  61. Interaction.init = function() {
  62. Interaction.getMenu();
  63. Interaction.getToolBar();
  64. Interaction.getCadToolBarPanel();
  65. Interaction.getToolMatrixPanel();
  66. };