# Fwd: Cartesian editor

**URL:** <https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635>\
**Category:** Development\
**Created:** [November 4, 2009, 12:44pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635 "2009-11-04T12:44:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Konstantin\_Tokarev](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Konstantin\_Tokarev](https://discuss.avogadro.cc/u/Konstantin_Tokarev)\
**Post date:** [November 4, 2009, 12:44pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/1 "2009-11-04T12:44:31Z")

</div>

Hi,

That’s great you have merged my new cartesian editor! However, there are several related problems:

1. Since it’s my first Avogadro extension, I’m not absolutely shure I’ve made all connects/disconnects properly.
2. I’ve used font family “Monospace”, because with standard font editor doesn’t look fine. I’m not sure if it does not break portability
3. I’ve used fixed value of font size “10” in cartesianeditor.ui to make font slightly bigger than other in UI, but if system default is not “9” it seems too big. Maybe change it inside code to somethink like “default+1”?
4. General problem of all “Properties” extensions is problem of multiple undos. Currently, extension supports only one undo operation, and it needs to be returned when extension starts. Properties extension makes non-modal dialogs, and if user changes several values, no undo is available, but ideally change of every parameter must have undo. Since I’ve started new cartesian editor using properties extension as reference, I’ve also made it non-modal
5. Since it is non-modal, if user changes molecule, coordinates in editor are changed. But I didn’t find proper signal of molecule to connect with for changing coordinates on manipulations. moleculeChanged is emitted only if atoms were added/removed, atomUpdated isn’t emited on atom movements. What signal should be used?
6. I’ve blocked old editor. If you think it isn’t useful anymore, dead code should be removed (not only commented by me, but also in propmodel.cpp. Another ways are to transofm it into fractional coordinate editor for xstallography, as it was requested recently, or move coordiantes’ columns into atom propertied dialog

04.11.09, 00:01, “Marcus D. Hanwell” :

> I think the new Cartesian editor looks great, but should remain  
> in master only IMHO - it has new features, UI, strings, and does not  
> conform to our indentation style.

I see it doesn’t follow Human Interface Guides of KDE4, but I’ve tried to make it maximally ergonomic for people working in quantum chemistry (and quite convenient for others). It’s not usual text editor and shouldn’t be.  
If you have ideas about UI improvement, I’ll change it gladly

–  
Regards,  
Konstantin

-------- Завершение пересылаемого сообщения --------

–  
Regards,  
Konstantin

Почта с приветом находится здесь: [http://mail.yandex.ru/promo/new/cards](http://mail.yandex.ru/promo/new/cards)

---

<div class="post-metadata">

**Author:** ![allison.vacanti](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/allison.vacanti/32/112_2.png) [@allison.vacanti](https://discuss.avogadro.cc/u/allison.vacanti)\
**Post date:** [November 4, 2009, 1:33pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/2 "2009-11-04T13:33:42Z")

</div>

Hi Konstantin,

I may be able to help with a couple of these 🙂

> 1. I’ve used fixed value of font size “10” in cartesianeditor.ui to  
> make font slightly bigger than other in UI, but if system default is  
> not “9” it seems too big. Maybe change it inside code to somethink  
> like “default+1”?

Take a look at QApplication::font().pointSize(). Is this what you are  
looking for?

[http://doc.trolltech.com/4.5/qapplication.html#font](http://doc.trolltech.com/4.5/qapplication.html#font)  
[http://doc.trolltech.com/4.5/qfont.html#pointSize](http://doc.trolltech.com/4.5/qfont.html#pointSize)

> 1. Since it is non-modal, if user changes molecule, coordinates in  
> editor are changed. But I didn’t find proper signal of molecule to  
> connect with for changing coordinates on  
> manipulations. moleculeChanged is emitted only if atoms were  
> added/removed, atomUpdated isn’t emited on atom movements. What  
> signal should be used?

I’m not sure about this, but maybe Avogadro::Primitive::updated(),  
which Atom/Molecule inherit?

> Another ways are to transofm it into fractional  
> coordinate editor for xstallography, as it was requested recently,

I requested this, and planned to add it myself at some point, but I  
probably wouldn’t get to it for a while. So, if you’d like to put it  
in, be my guest 🙂 If you are going to, I just wanted make you aware  
of OpenBabel::OBUnitCell::GetFractionalMatrix()  
[http://openbabel.org/api/2.2.0/classOpenBabel\_1\_1OBUnitCell.shtml#2ac2c43b65936f802681d33aff49bc25](http://openbabel.org/api/2.2.0/classOpenBabel_1_1OBUnitCell.shtml#2ac2c43b65936f802681d33aff49bc25)  
which makes the whole operation much easier.

> “Marcus D. Hanwell” wrote: \> I think the new Cartesian editor looks  
> great, but should remain \> in master only IMHO - it has new features,  
> UI, strings, and does not \> conform to our indentation style.
> 
> I see it doesn’t follow Human Interface Guides of KDE4, but I’ve  
> tried to make it maximally ergonomic for people working in quantum  
> chemistry (and quite convenient for others). It’s not usual text  
> editor and shouldn’t be. If you have ideas about UI improvement,  
> I’ll change it gladly

I believe Marcus is refering to how the code is indented, not the  
output in the widget. We use the KDE conventions for code style:

[http://techbase.kde.org/Policies/Kdelibs\_Coding\_Style](http://techbase.kde.org/Policies/Kdelibs_Coding_Style)

Hope this helps!

Dave

---

<div class="post-metadata">

**Author:** ![mhanwell](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/mhanwell/32/16_2.png) [@mhanwell](https://discuss.avogadro.cc/u/mhanwell)\
**Post date:** [November 4, 2009, 1:48pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/3 "2009-11-04T13:48:10Z")

</div>

Konstantin Tokarev wrote:

> Hi,
> 
> That’s great you have merged my new cartesian editor! However, there are several related problems:
> 
> 04.11.09, 00:01, “Marcus D. Hanwell” :
> 
> > I think the new Cartesian editor looks great, but should remain  
> > in master only IMHO - it has new features, UI, strings, and does not  
> > conform to our indentation style.
> 
> I see it doesn’t follow Human Interface Guides of KDE4, but I’ve tried to make it maximally ergonomic for people working in quantum chemistry (and quite convenient for others). It’s not usual text editor and shouldn’t be.  
> If you have ideas about UI improvement, I’ll change it gladly

Hi Konstantin,

I think it is a great addition, there are a few rough edges but they can  
be worked out in master. My time has been very limited these last few  
weeks as I began a new job in a new area on 1 October, and to add to  
that have a new family (five month old baby).

We also just had our first stable release, and I think everyone is  
getting used to that. I think that this editor belongs in master, and we  
can work on any remaining issues there. I think we should be very  
careful with the 1.0 branch, and most developers should not be too  
concerned with it unless there are bugs that need fixing.

Thanks for contributing the Cartesian editor, I am very pleased to have  
a new contributor adding cool functionality. We can test portability etc  
as we ready master for a new stable release. I will also be looking into  
getting the dashboards up and running again.

Thanks,

Marcus

---

<div class="post-metadata">

**Author:** ![Konstantin\_Tokarev](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Konstantin\_Tokarev](https://discuss.avogadro.cc/u/Konstantin_Tokarev)\
**Post date:** [November 4, 2009, 6:43pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/4 "2009-11-04T18:43:51Z")

</div>

1. In my cartesian editor I’ve written a fuction which obtains number of element from its IUPAC name. It’s possible to move it into OpenBabel, if anybody other needs such functionality
2. If toggle button betweeen two versions of editor is needed, two extensions (cartesianextension and propextension) will depend on each other. Is it OK?

---

<div class="post-metadata">

**Author:** ![Konstantin\_Tokarev](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Konstantin\_Tokarev](https://discuss.avogadro.cc/u/Konstantin_Tokarev)\
**Post date:** [November 5, 2009, 8:38pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/5 "2009-11-05T20:38:49Z")

</div>

> Take a look at QApplication::font().pointSize(). Is this what you are  
> looking for?  
> [http://doc.trolltech.com/4.5/qapplication.html#font](http://doc.trolltech.com/4.5/qapplication.html#font)  
> [http://doc.trolltech.com/4.5/qfont.html#pointSize](http://doc.trolltech.com/4.5/qfont.html#pointSize)

Unfortunately, it doesn’t work. Since font size is default, fontPointSize() returns 0

–  
Regards,  
Konstantin

---

<div class="post-metadata">

**Author:** ![Konstantin\_Tokarev](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/k/ecd19e/32.png) [@Konstantin\_Tokarev](https://discuss.avogadro.cc/u/Konstantin_Tokarev)\
**Post date:** [November 6, 2009, 6:01pm UTC](https://discuss.avogadro.cc/t/fwd-cartesian-editor/1635/6 "2009-11-06T18:01:20Z")

</div>

> > 1. Since it is non-modal, if user changes molecule, coordinates in  
> > editor are changed. But I didn’t find proper signal of molecule to  
> > connect with for changing coordinates on  
> > manipulations. moleculeChanged is emitted only if atoms were  
> > added/removed, atomUpdated isn’t emited on atom movements. What  
> > signal should be used?  
> > I’m not sure about this, but maybe Avogadro::Primitive::updated(),  
> > which Atom/Molecule inherit?

## I’ve connected this signal, but it doesn’t work.

Regards,  
Konstantin
