This file is indexed.

/usr/share/help/ko/gnome-devel-demos/image.py.page is in gnome-devel-docs 3.28.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/" xmlns:its="http://www.w3.org/2005/11/its" xmlns:xi="http://www.w3.org/2001/XInclude" type="guide" style="task" id="image.py" xml:lang="ko">
  <info>
    <title type="text">Image(Python)</title>
    <link type="guide" xref="beginner.py#display-widgets"/>
    <link type="seealso" xref="properties.py"/>
    <link type="next" xref="strings.py"/>
    <revision version="0.2" date="2012-06-14" status="draft"/>

    <credit type="author copyright">
      <name>Marta Maria Casetti</name>
      <email its:translate="no">mmcasetti@gmail.com</email>
      <years>2012</years>
    </credit>
    <credit type="editor">
      <name>Sindhu S</name>
      <email its:translate="no">sindhus@live.in</email>
      <years>2014</years>
    </credit>

    <desc>그림을 표시하는 위젯</desc>
  
    <mal:credit xmlns:mal="http://projectmallard.org/1.0/" type="translator copyright">
      <mal:name>조성호</mal:name>
      <mal:email>shcho@gnome.org</mal:email>
      <mal:years>2017</mal:years>
    </mal:credit>
  </info>

  <title>Image</title>
  <media type="image" mime="image/png" src="media/image.png"/>
  <p>이 GtkApplication에서는 현재 디렉터리의 그림파일을 보여줍니다.</p>

  <note><p>그림 파일을 제대로 불러오지 않았다면, 그림에 "깨진 그림" 아이콘이 들어갑니다. 이 코드가 동작하려면 현재 디렉터리에 <file>filename.png</file> 파일이 있어야합니다.</p></note>

  <links type="section"/>

  <section id="code">
  <title>예제 결과를 만드는 코드</title>

  <code mime="text/x-python" style="numbered">
  from gi.repository import Gtk
import sys


class MyWindow(Gtk.ApplicationWindow):
    # create a window

    def __init__(self, app):
        Gtk.Window.__init__(self, title="Welcome to GNOME", application=app)
        self.set_default_size(300, 300)

        # create an image
        image = Gtk.Image()
        # set the content of the image as the file filename.png
        image.set_from_file("gnome-image.png")
        # add the image to the window
        self.add(image)


class MyApplication(Gtk.Application):

    def __init__(self):
        Gtk.Application.__init__(self)

    def do_activate(self):
        win = MyWindow(self)
        win.show_all()

    def do_startup(self):
        Gtk.Application.do_startup(self)

app = MyApplication()
exit_status = app.run(sys.argv)
sys.exit(exit_status)

  </code>

  <p>우리 예제에서 그림을 다른 클래스의 인스턴스로 만들고 <code>do_activate(self)</code> 메서드에서 <code>MyWindow</code>의 인스턴스로 초기화 하는 다른 방법이 있습니다:</p>

  <code mime="text/x-python">
    # a class to create a window
    class MyWindow(Gtk.ApplicationWindow):
    def __init__(self, app):
        Gtk.Window.__init__(self, title="Welcome to GNOME", application=app)
        self.set_default_size(300, 300)

    # a class to create an image
    class MyImage(Gtk.Image):
    def __init__(self):
        Gtk.Image.__init__(self)
        self.set_from_file("gnome-image.png")

    class MyApplication(Gtk.Application):
    def __init__(self):
        Gtk.Application.__init__(self)

    def do_activate(self):
        # create an instance of MyWindow
        win = MyWindow(self)
        # create an instance of MyImage and add it to the window
        win.add(MyImage())
        # show the window and everything on it
        win.show_all()
  </code>

  <note>
    <p>이 코드 부분을 사용하려면, <code>gi.repository</code>에서 <code>Gtk</code><code>GdkPixbuf</code>를 임포팅하는 코드와 <code>MyApplication</code> 창을 초기화하는 여러 줄의 코드를 추가해야 합니다.</p>
  </note>
  </section>

  <section id="methods">
  <title>Image 위젯에 쓸만한 메서드</title>

  <list>
    <item>
      <p>네트워크에서 그림을 불러오려면 <code>set_from_pixbuf(pixbuf)</code> 함수를 사용하십시오. 여기서 <code>pixbuf</code><link href="https://developer.gnome.org/gdk-pixbuf/unstable/index.html"> GdkPixbuf</link>입니다.</p>
      <code mime="text/python">
        from gi.repository import Gtk
        from gi.repository import GdkPixbuf
        import sys

        class MyWindow(Gtk.ApplicationWindow):
            # create a window
            def __init__(self, app):
                Gtk.Window.__init__(self, title="Welcome to GNOME", application=app)
                self.set_default_size(300, 300)

                # create a pixbuf from file filename="gnome-image.png", with width=32
                # and height=64 amd boolean preserve_aspect_ratio=False.
                pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale("gnome-image.png", 64, 128, False)

                # create an image
                image = Gtk.Image()
                # set the content of the image as the pixbuf
                image.set_from_pixbuf(pixbuf)
                # add the image to the window
                self.add(image)
        </code>
        <p><code>preserve_aspect_ratio=True</code>이면, <code>new_from_file_at_size(filename, width, height)</code> 함수를 사용할 수 있습니다. <code>width</code> 또는 <code>height</code> 값이 <code>-1</code>이면 제약을 받지 않습니다.</p>
        <p>입력 스트림에서 불러오는 방법을 알아보려면, 문서에서 <code>new_from_stream()</code>함수와 <code>new_from_stream_at_scale()</code>함수 내용을 참고하십시오.</p>
    </item>
  </list>
  </section>

  <section id="references">
    <title>API 참고서</title>

    <p>이 예제는 다음 참고자료가 필요합니다:</p>
    <list>
      <item>
        <p><link href="https://developer.gnome.org/gtk3/unstable/GtkImage.html"> GtkImage</link></p>
      </item>
      <item>
        <p><link href="https://developer.gnome.org/gtk3/unstable/GtkWindow.html"> GtkWindow</link></p>
      </item>
    </list>

  </section>
</page>