Autor Tópico: De Kommander para Python (ou outro)  (Lida 1516 vezes)

Offline vampire_thunder

  • Usuário Ubuntu
  • *
  • Mensagens: 735
    • Ver perfil
De Kommander para Python (ou outro)
« Online: 18 de Outubro de 2009, 18:42 »
Alguém que conhece as linguagens de programação, saberia me dizer como faço para converter um código escrito para o Kommander (KDE3) em python, ou outra linguagem, como shell script?
O problema está relatado aqui:
http://biglinux.com.br/forum/viewtopic.php?p=58351#58351

O código é esse (retirado do Big Linux 4 e adaptado para o Kommander do KDE4, no Ubuntu 9.04):
Código: [Selecionar]
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>Form1</class>
<widget class="Dialog">
    <property name="name">
        <cstring>Form1</cstring>
    </property>
    <property name="geometry">
        <rect>
            <x>0</x>
            <y>0</y>
            <width>374</width>
            <height>443</height>
        </rect>
    </property>
    <property name="caption">
        <string>Alterar imagem do Grub</string>
    </property>
    <property name="associations" stdset="0">
        <stringlist>
            <string></string>
            <string>@exec(if test $(id -u) != 0; then
dcop @dcopid KommanderIf setEnabled ExecButton1 false
dcop @dcopid KommanderIf setEnabled ExecButton2 false
dcop @dcopid KommanderIf setEnabled ExecButton3 false
kdialog --msgbox "Somente o usuário root pode utilizar esse configurador."
fi)

mkdir /etc/biggrub/tmp
cd /etc/biggrub/tmp
cpio -i &lt; /boot/message


if [ -e "/etc/biggrub/tmp/panim.jpg" ]; then
dcop @dcopid KommanderIf setChecked CheckBox1 true
fi


@preview.setText("/etc/biggrub/pback.jpg")
</string>
            <string></string>
        </stringlist>
    </property>
    <widget class="Label">
        <property name="name">
            <cstring>Label3</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>20</x>
                <y>10</y>
                <width>330</width>
                <height>31</height>
            </rect>
        </property>
        <property name="text">
            <string>Alterar imagem do Grub.</string>
        </property>
        <property name="alignment">
            <set>AlignCenter</set>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string></string>
            </stringlist>
        </property>
    </widget>
    <widget class="PixmapLabel">
        <property name="name">
            <cstring>preview</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>22</x>
                <y>46</y>
                <width>329</width>
                <height>233</height>
            </rect>
        </property>
        <property name="paletteBackgroundColor">
            <color>
                <red>230</red>
                <green>230</green>
                <blue>230</blue>
            </color>
        </property>
        <property name="frameShape">
            <enum>GroupBoxPanel</enum>
        </property>
        <property name="scaledContents">
            <bool>true</bool>
        </property>
        <property name="populationText">
            <string></string>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string>@widgetText</string>
            </stringlist>
        </property>
    </widget>
    <widget class="Label">
        <property name="name">
            <cstring>Label2</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>2</x>
                <y>418</y>
                <width>355</width>
                <height>17</height>
            </rect>
        </property>
        <property name="text">
            <string>Selecione a nova imagem para o Grub</string>
        </property>
        <property name="alignment">
            <set>AlignCenter</set>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string></string>
            </stringlist>
        </property>
    </widget>
    <widget class="ButtonGroup">
        <property name="name">
            <cstring>ButtonGroup2_2</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>21</x>
                <y>310</y>
                <width>330</width>
                <height>50</height>
            </rect>
        </property>
        <property name="title">
            <string>Aplicar efeitos na imagem</string>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string>@widgetText</string>
                <string></string>
            </stringlist>
        </property>
        <widget class="RadioButton">
            <property name="name">
                <cstring>RadioButton4</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>150</x>
                    <y>20</y>
                    <width>40</width>
                    <height>22</height>
                </rect>
            </property>
            <property name="text">
                <string>&amp;1</string>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string></string>
                    <string>1.png</string>
                </stringlist>
            </property>
        </widget>
        <widget class="RadioButton">
            <property name="name">
                <cstring>RadioButton1</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>30</x>
                    <y>20</y>
                    <width>77</width>
                    <height>22</height>
                </rect>
            </property>
            <property name="text">
                <string>Nenh&amp;um</string>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string></string>
                    <string>0.png</string>
                </stringlist>
            </property>
        </widget>
        <widget class="RadioButton">
            <property name="name">
                <cstring>RadioButton5</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>249</x>
                    <y>20</y>
                    <width>40</width>
                    <height>22</height>
                </rect>
            </property>
            <property name="text">
                <string>&amp;2</string>
            </property>
            <property name="checked">
                <bool>true</bool>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string></string>
                    <string>2.png</string>
                </stringlist>
            </property>
        </widget>
    </widget>
    <widget class="ButtonGroup">
        <property name="name">
            <cstring>ButtonGroup2</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>10</x>
                <y>370</y>
                <width>347</width>
                <height>36</height>
            </rect>
        </property>
        <property name="frameShape">
            <enum>NoFrame</enum>
        </property>
        <property name="frameShadow">
            <enum>Plain</enum>
        </property>
        <property name="lineWidth">
            <number>0</number>
        </property>
        <property name="title">
            <string></string>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string></string>
                <string></string>
            </stringlist>
        </property>
        <widget class="CloseButton">
            <property name="name">
                <cstring>CloseButton2</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>264</x>
                    <y>5</y>
                    <width>76</width>
                    <height>26</height>
                </rect>
            </property>
            <property name="text">
                <string>Fec&amp;har</string>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string></string>
                </stringlist>
            </property>
        </widget>
        <widget class="ExecButton">
            <property name="name">
                <cstring>ExecButton2</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>171</x>
                    <y>5</y>
                    <width>76</width>
                    <height>26</height>
                </rect>
            </property>
            <property name="text">
                <string>Apl&amp;icar</string>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string>@ButtonGroup2.setEnabled(false)
@Label2.setText("Processando...")
@aplicar
@Label2.setText("Imagem do Grub alterada.")
@ButtonGroup2.setEnabled(true)
</string>
                </stringlist>
            </property>
        </widget>
        <widget class="ExecButton">
            <property name="name">
                <cstring>ExecButton1</cstring>
            </property>
            <property name="geometry">
                <rect>
                    <x>8</x>
                    <y>5</y>
                    <width>157</width>
                    <height>26</height>
                </rect>
            </property>
            <property name="text">
                <string>Seleci&amp;onar Imagem</string>
            </property>
            <property name="associations" stdset="0">
                <stringlist>
                    <string>@Label2.setText("Selecione a imagem.")

@exec(convert @Input.openfile(/usr/share/wallpapers, *.png *.jpg *.gif *.bmp *.svg) -resize 800x600\! /etc/biggrub/orig.jpg)

@exec(composite -compose atop /etc/biggrub/\@ButtonGroup2_2 /etc/biggrub/orig.jpg /etc/biggrub/pback.jpg)

@preview.setText("/etc/biggrub/pback.jpg")

@preview.setText("/etc/biggrub/pback.jpg")
@Label2.setText("Para utilizar a imagem selecionada clique em aplicar.")</string>
                </stringlist>
            </property>
        </widget>
    </widget>
    <widget class="CheckBox">
        <property name="name">
            <cstring>CheckBox1</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>30</x>
                <y>280</y>
                <width>220</width>
                <height>30</height>
            </rect>
        </property>
        <property name="text">
            <string>Pin&amp;guins passeando na tela</string>
        </property>
        <property name="populationText">
            <string></string>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string>rm -f /etc/biggrub/aplicar/panim_a.jpg
rm -f /etc/biggrub/aplicar/panim.jpg</string>
                <string></string>
                <string>cp -f /etc/biggrub/panim_a.jpg /etc/biggrub/aplicar/panim_a.jpg
cp -f /etc/biggrub/panim.jpg /etc/biggrub/aplicar/panim.jpg
</string>
            </stringlist>
        </property>
    </widget>
    <widget class="ScriptObject">
        <property name="name">
            <cstring>aplicar</cstring>
        </property>
        <property name="geometry">
            <rect>
                <x>0</x>
                <y>350</y>
                <width>32</width>
                <height>32</height>
            </rect>
        </property>
        <property name="associations" stdset="0">
            <stringlist>
                <string>rm -Rf /etc/biggrub/aplicar
mkdir /etc/biggrub/aplicar
cd /etc/biggrub/aplicar/
cpio -i &lt; /boot/message
cp -f /etc/biggrub/pback.jpg /etc/biggrub/aplicar/pback.jpg
cp -f /etc/biggrub/gfxboot.cfg /etc/biggrub/aplicar/gfxboot.cfg
@CheckBox1
ls . |cpio -o &gt; /boot/message</string>
            </stringlist>
        </property>
    </widget>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>