Kaydet (Commit) 08b23376 authored tarafından Emin Fedar's avatar Emin Fedar

Initialize

üst e3deb1be
import os, subprocess
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib, Gio
import locale
from locale import gettext as tr
# Translation Constants:
APPNAME = "pardus-gtk-ornek"
TRANSLATIONS_PATH = "/usr/share/locale"
SYSTEM_LANGUAGE = os.environ.get("LANG")
# Translation functions:
locale.bindtextdomain(APPNAME, TRANSLATIONS_PATH)
locale.textdomain(APPNAME)
locale.setlocale(locale.LC_ALL, SYSTEM_LANGUAGE)
class MainWindow:
def __init__(self, app):
# Gtk Builder nesnesini oluşturduk
self.builder = Gtk.Builder()
# Builder'a glade'de hazırladığımız arayüzümüzü verdik
self.builder.add_from_file(os.path.dirname(os.path.abspath(__file__)) + "/../ui/MainWindow.glade")
self.builder.connect_signals(self) # Signals kısmındaki metodlar bu sınıfın içine yazılacak.
# Window
self.window = self.builder.get_object("window") # Pencere elemanımıza eriştik
self.window.set_application(app) # Penceremizin uygulamasını main.py'den aldığımız Gtk.Application'a ayarladık
# Ekranı göster
self.window.show_all()
def btn_selam_clicked(self, btn):
process = subprocess.run("ls", capture_output=True)
print(process.stdout)
print(tr("Hello"))
#!/usr/bin/python3
import sys
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GLib, Gio
from MainWindow import MainWindow
class Uygulama(Gtk.Application):
def __init__(self, *args, **kwargs):
super().__init__(*args, application_id="tr.org.pardus.ornek-uygulama", flags=Gio.ApplicationFlags.FLAGS_NONE, **kwargs)
def do_activate(self):
self.window = MainWindow(self)
app = Uygulama()
app.run(sys.argv)
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
# Emin fedar <emin.fedar@pardus.org.tr>, 2021.
#
msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-27 18:48+0300\n"
"PO-Revision-Date: 2021-04-27 18:50+0300\n"
"Last-Translator: Emin fedar <emin.fedar@pardus.org.tr>\n"
"Language-Team: Turkish <gelistirici@pardus.org.tr>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0\n"
"X-Generator: Gtranslator 3.38.0\n"
#: ../src/MainWindow.py:39
msgid "Hello"
msgstr "Merhaba"
#: ../ui/MainWindow.glade:18
msgid "Merhaba Dünya!"
msgstr "Hello World"
#: ../ui/MainWindow.glade:32
msgid "Selam!"
msgstr "Hi!"
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-04-27 18:48+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/MainWindow.py:39
msgid "Hello"
msgstr ""
#: ../ui/MainWindow.glade:18
msgid "Merhaba Dünya!"
msgstr ""
#: ../ui/MainWindow.glade:32
msgid "Selam!"
msgstr ""
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow" id="window">
<property name="can-focus">False</property>
<property name="default-width">440</property>
<property name="default-height">250</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lbl_merhaba">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Merhaba Dünya!</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="absolute-size" value="24000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_selam">
<property name="label" translatable="yes">Selam!</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<signal name="clicked" handler="btn_selam_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">128</property>
<property name="icon-name">battery</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkWindow">
<property name="can-focus">False</property>
<property name="default-width">440</property>
<property name="default-height">250</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="lbl_merhaba">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Merhaba Dünya!</property>
<attributes>
<attribute name="weight" value="bold"/>
<attribute name="absolute-size" value="24000"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="btn_selam">
<property name="label" translatable="yes">Selam!</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="halign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<signal name="clicked" handler="btn_selam_clicked" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">128</property>
<property name="icon-name">battery</property>
<property name="icon_size">5</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment