<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to sub2srt-python-GUI.py source</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%2520source/</link><description>Recent changes to sub2srt-python-GUI.py source</description><atom:link href="https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%20source/feed" rel="self"/><language>en</language><lastBuildDate>Sat, 07 Jul 2012 06:05:56 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%20source/feed" rel="self" type="application/rss+xml"/><item><title>WikiPage sub2srt-python-GUI.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%2520source/</link><description>&lt;pre&gt;--- v2
+++ v3
@@ -1,11 +1,12 @@
-#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
     # Name:        sub2srt-python-GUI
     # Purpose:
     #
     # Author:      Bojan
     #
-    # Created:     24/06/2012
+    # Created:     8:03 AM 7/7/2012
     # Licence:     bsd
+    # Version:     1.0b
     #-------------------------------------------------------------------------------
     #!/usr/bin/env python
 
@@ -32,13 +33,16 @@
         subloc = '"' + subloc +'"'
         source_edit_variable.set(subloc)
         dest_edit_variable.set(subloc.replace('.sub','.srt'))
-
+        #set width. although different ending srt/sub, length is the same
+        source_edit['width'] = len(subloc)
+        dest_edit['width'] = len(subloc)
 
 
     def save_as_srt_file():
         srtloc = filedialog.asksaveasfilename(initialdir=os.path.expanduser('~'),filetypes=[('Subrip subtitle','*.srt')]      )
         srtloc = '"' + srtloc +'"'
         dest_edit_variable.set(srtloc)
+        dest_edit['width'] = len(srtloc)
 
     def preview_movie():
         previewloc = source_edit_variable.get()
@@ -62,16 +66,15 @@
 
     #frame init
     mainframe = ttk.Frame(root, padding="3 3 12 12")
-    mainframe.columnconfigure(0, weight=1)
-    mainframe.rowconfigure(0, weight=1)
     mainframe.grid(column=0, row=0, sticky=(N,W,E,S))
 
-    #frame will expand
-    mainframe.columnconfigure(0, weight=3)
-    mainframe.columnconfigure(1, weight=3)
-    mainframe.columnconfigure(2, weight=3)
-    mainframe.columnconfigure(3, weight=1)
-    mainframe.columnconfigure(4, weight=1)
+    #only middle frame.column will expand.
+    mainframe.columnconfigure(0, weight=0)
+    mainframe.columnconfigure(1, weight=1)
+    #mainframe.columnconfigure(1,minsize=330 )
+    mainframe.columnconfigure(2, weight=0)
+    mainframe.columnconfigure(3, weight=0)
+    mainframe.columnconfigure(4, weight=0)
     #mainframe.rowconfigure(0, weight=1)
 
     #for test
@@ -87,11 +90,15 @@
 
     #we hold widget state in special variable, gui gets updated automatically. use get/set to read/write from it
     source_edit_variable = StringVar()
-    source_edit = ttk.Entry(mainframe,  textvariable=source_edit_variable).grid(column=1, row=1, sticky=EW )
+    #you can add width or height here:
+    source_edit = ttk.Entry(mainframe,  textvariable=source_edit_variable)
+    #if we use myedit = ttk.entru(..).grid(), myedit[width]=.. will show error. so we use separately, like next line
+    source_edit.grid(column=1, row=1, sticky=EW )
 
 
     dest_edit_variable = StringVar()
-    dest_edit = ttk.Entry(mainframe,  textvariable=dest_edit_variable).grid(column=1, row=2, sticky=EW )
+    dest_edit = ttk.Entry(mainframe,  textvariable=dest_edit_variable)
+    dest_edit.grid(column=1, row=2, sticky=EW )
 
 
     fps_combobox_variable = StringVar()
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Sat, 07 Jul 2012 06:05:56 -0000</pubDate><guid>https://sourceforge.netbed448d7cabc381f099923a6637494a100ffdcc1</guid></item><item><title>WikiPage sub2srt-python-GUI.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%2520source/</link><description>&lt;pre&gt;--- v1
+++ v2
@@ -20,7 +20,6 @@
     def convert(*args):
         try:
             command_line = "python.exe sub2srt-python-command-line.py " + source_edit_variable.get() + " " + dest_edit_variable.get() + " " + fps_combobox_variable.get()
-            os.system(command_line)
             if os.system(command_line) == 0:
                 status['text'] = 'status = command completed succesfully'
             else:
&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Fri, 06 Jul 2012 11:56:43 -0000</pubDate><guid>https://sourceforge.net8a8345c27de12ea58a1dc3d4bb70b289d59cd42e</guid></item><item><title>WikiPage sub2srt-python-GUI.py source modified by Bojan</title><link>https://sourceforge.net/p/sub2srtpython/wiki/sub2srt-python-GUI.py%2520source/</link><description>#-------------------------------------------------------------------------------
    # Name:        sub2srt-python-GUI
    # Purpose:
    #
    # Author:      Bojan
    #
    # Created:     24/06/2012
    # Licence:     bsd
    #-------------------------------------------------------------------------------
    #!/usr/bin/env python

    import os
    import subprocess
    #suproces needed for open file, os for os.*
    from tkinter import *
    from tkinter import ttk
    from tkinter import filedialog

    #functions callable
    def convert(*args):
        try:
            command_line = "python.exe sub2srt-python-command-line.py " + source_edit_variable.get() + " " + dest_edit_variable.get() + " " + fps_combobox_variable.get()
            os.system(command_line)
            if os.system(command_line) == 0:
                status['text'] = 'status = command completed succesfully'
            else:
                status['text'] = 'status = failed, sorry'
        except ValueError:
            pass

    def find_sub_file():
        subloc = filedialog.askopenfilename( initialdir=os.path.expanduser('~'),filetypes=[('MicroDVD subtitle','*.sub')] )
        subloc = '"' + subloc +'"'
        source_edit_variable.set(subloc)
        dest_edit_variable.set(subloc.replace('.sub','.srt'))



    def save_as_srt_file():
        srtloc = filedialog.asksaveasfilename(initialdir=os.path.expanduser('~'),filetypes=[('Subrip subtitle','*.srt')]      )
        srtloc = '"' + srtloc +'"'
        dest_edit_variable.set(srtloc)

    def preview_movie():
        previewloc = source_edit_variable.get()
        previewloc = previewloc.replace('.sub','.avi')
        #os.startfile(previewloc)
        #start file win only
        if sys.platform.startswith('darwin'):
            subprocess.call(('open', previewloc))
        elif os.name == 'nt':
            os.startfile(previewloc)
        elif os.name == 'posix':
            subprocess.call(('xdg-open', previewloc))

    #appwindow init
    root = Tk()
    root.title("Sub2srt-python-GUI")
    #appwindow will expand
    root.columnconfigure(0,weight=1)
    root.rowconfigure(1,weight=1)


    #frame init
    mainframe = ttk.Frame(root, padding="3 3 12 12")
    mainframe.columnconfigure(0, weight=1)
    mainframe.rowconfigure(0, weight=1)
    mainframe.grid(column=0, row=0, sticky=(N,W,E,S))

    #frame will expand
    mainframe.columnconfigure(0, weight=3)
    mainframe.columnconfigure(1, weight=3)
    mainframe.columnconfigure(2, weight=3)
    mainframe.columnconfigure(3, weight=1)
    mainframe.columnconfigure(4, weight=1)
    #mainframe.rowconfigure(0, weight=1)

    #for test
    #mainframe["relief"]="sunken"



    #elements init
    ttk.Label(mainframe, text='Source (.sub file):').grid(column=0, row=1, sticky=W)
    ttk.Label(mainframe, text='Destination (.srt file, auto name):').grid(column=0, row=2, sticky=W)
    ttk.Label(mainframe, text='FPS:').grid(column=0, row=3, sticky=(W))


    #we hold widget state in special variable, gui gets updated automatically. use get/set to read/write from it
    source_edit_variable = StringVar()
    source_edit = ttk.Entry(mainframe,  textvariable=source_edit_variable).grid(column=1, row=1, sticky=EW )


    dest_edit_variable = StringVar()
    dest_edit = ttk.Entry(mainframe,  textvariable=dest_edit_variable).grid(column=1, row=2, sticky=EW )


    fps_combobox_variable = StringVar()
    #set init value
    fps_combobox_variable.set('25')
    #add combobox values, 25,23.976
    fps_combobox = ttk.Combobox(mainframe,  textvariable=fps_combobox_variable, values=(25,23.976))
    fps_combobox.grid(column=1, row=3, sticky=EW )


    ttk.Button(mainframe, text="Find .sub file ...", command=find_sub_file).grid(column=2, row=1, sticky=E)
    ttk.Button(mainframe, text="Save as .srt file ...", command=save_as_srt_file).grid(column=2, row=2, sticky=E)
    ttk.Button(mainframe, text="Preview movie (to see fps)", command=preview_movie).grid(column=2, row=3, sticky=E)


    ttk.Button(mainframe, text="Convert!", command=convert, padding =(40,10)).grid(column=2, row=4, sticky=E)

    status = Label(mainframe, text="status = OK")
    status.grid(column=0, row=5,sticky=SW,columnspan=3 )
    #status["relief"]="sunken"

    #neat it up
    for child in mainframe.winfo_children(): child.grid_configure(padx=4, pady=4)



    root.mainloop()
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bojan</dc:creator><pubDate>Fri, 06 Jul 2012 10:27:05 -0000</pubDate><guid>https://sourceforge.net626a11dfeb9c9c22671bec9489092bce651bc351</guid></item></channel></rss>