Opened 12 years ago

Closed 7 years ago

#1858 closed enhancement (fixed)

Better template classes

Reported by: perost Owned by: adeas31
Priority: low Milestone: 1.13.0
Component: OMEdit Version:
Keywords: Cc: perost

Description

We should change the template classes for new classes in OMEdit to be a bit more user-friendly. E.g. add an empty equation section to models, and an empty algorithm section to functions.

Change History (11)

comment:1 Changed 12 years ago by perost

  • Milestone 1.9.0 deleted
  • Owner changed from perost to somebody else
  • Status changed from new to assigned

This seemed like an easy thing to fix, but as usual I was wrong. OMEdit creates a string with the class and routes it through OMC which gleefully (I imagine) strips empty equation/algorithm sections.

comment:2 Changed 12 years ago by sjoelund.se

  • Owner changed from somebody else to adeas31

comment:3 follow-up: Changed 12 years ago by adeas31

We can add the equation/algorithm within the string that OMEdit routes through OMC and it will work. The problem is the list API which strips out the empty equation/algorithm sections. Create a file with empty sections, load it and then call list on the classes.

I think its not really required. It won't be helpful for users since OMEdit is a graphical editor. This feature is already in MDT and is handy there since MDT is a textual editor.

comment:4 in reply to: ↑ 3 ; follow-up: Changed 12 years ago by sjoelund.se

Replying to adeas31:

The problem is the list API

No, the problem is you use the list API instead of reading the buffer from file. Using the list API means all error-messages you get from OMC are wrong

comment:5 in reply to: ↑ 4 ; follow-up: Changed 12 years ago by adeas31

Replying to sjoelund.se:

Replying to adeas31:

The problem is the list API

No, the problem is you use the list API instead of reading the buffer from file. Using the list API means all error-messages you get from OMC are wrong

Yes I use the list API. Since not all models are saved. If you create a new model and you need to show its text then you have to use the list API to get it.
Also, if you have a package and want to show the text of the nested model in it. In this case if I use the file reading stuff then there is a lot file handling stuff required.

comment:6 in reply to: ↑ 5 Changed 12 years ago by sjoelund.se

If you create a new model and you need to show its text then you have to use the list API to get it.

Not if you create your own buffer in OMEdit!

Also, if you have a package and want to show the text of the nested model in it. In this case if I use the file reading stuff then there is a lot file handling stuff required.

Exactly! Go do it ;)

comment:7 Changed 12 years ago by perost

OMEdit can ask the compiler for the file information of classes, so that it knows where a class begins and ends. Then it should be fairly trivial to get that part of the file from file or memory. I'm not sure if such an API exists already, but it should be easy to add.

comment:8 Changed 9 years ago by perost

  • Priority changed from high to low

comment:9 Changed 9 years ago by dietmarw

  • Milestone set to Future

comment:10 Changed 7 years ago by sjoelund.se

loadString("model M
equation
algorithm
end M;");getErrorString();
list();

Returns:

model M
equation

algorithm

end M;

So Adeel could implement this I guess...

comment:11 Changed 7 years ago by adeas31

  • Milestone changed from Future to 1.13.0
  • Resolution set to fixed
  • Status changed from assigned to closed

Done in 99e87f/OMEdit.

Note: See TracTickets for help on using tickets.