Photini 확장

새로운 《탭》을 제공함으로써 Photini에 새로운 기능을 추가할 수 있습니다. 탭은 런타임에 동적으로 로드되므로 새 탭은 Photini Python 패키지의 일부가 될 필요가 없습니다. 예를 들어, mypackage 패키지가 mypackage.photini 모듈에 Photini 탭을 제공하는 경우 탭 모듈 목록에 mypackage.photini 를 추가하고(참조 탭 순서 ) 탭을 Photini에 추가합니다.

모든 Photini 탭에는 다음 인터페이스가 있어야 합니다.

class TabWidget(QtWidgets.QWidget):
    @staticmethod
    def tab_name():
        return 'Tab name'

    def __init__(self, image_list, *arg, **kw):
        super(TabWidget, self).__init__(*arg, **kw)
        # Add child widgets here. Keep a reference to image_list if you need to
        # interact with the image selector.

    def refresh(self):
        # Called when the user selects the tab. If your tab does something
        # slow, such as contacting a server, then do it here rather than in
        # __init__. You might also want to update your tab to synchronise with
        # changes made in another tab, like the map tabs do. Otherwise, just
        # update the displayed metadata.
        self.new_selection(self.image_list.get_selected_images())

    def do_not_close(self):
        # Return True if your tab is busy (e.g. uploading photographs) and
        # wants to stop the user closing the Photini program.
        return False

    def new_selection(self, selection):
        # Called when the image thumbnail area has a new selection. Most tabs
        # will need to update their displayed metadata to suit the selection.

tab_name 메서드는 탭에 지정된 레이블을 반환합니다. 가능한 한 짧아야 합니다.

사용자가 새로운 메타데이터를 정의할 때 image_list 에서 현재 선택 항목을 가져와 선택 항목의 모든 이미지에 메타데이터를 설정해야 합니다.

원하는 작업과 가장 유사한 Photini 탭 모듈의 복사본으로 시작하고 필요하지 않은 부분을 제거한 다음 자신의 항목을 추가하는 것이 가장 쉬울 것입니다.


의견이나 질문이 있나요? Photini mailing list 《https://groups.google.com/forum/#!forum/photini》를 ​​구독하고 알려주세요.