Changeset - 62d83d456f2e
[Not reviewed]
default
1 1 1
drewp@bigasterisk.com - 13 years ago 2012-06-08 04:00:36
drewp@bigasterisk.com
curvecalc start gtk porting
Ignore-this: 85519936ae65aaa57cab3fd5d915e0de
2 files changed with 78 insertions and 78 deletions:
0 comments (0 inline, 0 general)
bin/curvecalc
Show inline comments
 
@@ -7,16 +7,17 @@ now launches like this:
 

	
 

	
 
todo: curveview should preserve more objects, for speed maybe
 

	
 
"""
 
from __future__ import division
 
import time,textwrap,os,optparse, urllib2
 
import Tix as tk
 
from twisted.internet import gtk2reactor
 
import time,textwrap,os,optparse, urllib2, gtk, gobject
 
import louie as dispatcher 
 
from twisted.internet import reactor,tksupport
 

	
 
from twisted.python.util import sibpath
 

	
 
from rdflib import URIRef
 
from rdflib import Graph
 
import rdflib
 
import logging
 
log = logging.getLogger()
 
@@ -125,12 +126,22 @@ def createHelpLines(root):
 
                     "Curve point bindings: B1 drag point; C-B1 curve add point; S-B1 sketch points; 1..5 add point at time; B1 drag select points",
 
                     "Available in functions: nsin/ncos period=amp=1; within(a,b) bef(x) aft(x) compare to time; smoove(x) cubic smoothstep; chan(name); curvename(t) eval curve"]:
 
        line = tk.Label(root, text=helpline, font="Helvetica -12 italic",
 
                        anchor='w')
 
        line.pack(side='top',fill='x')
 

	
 
class Main(object):
 
    def __init__(self):
 
        wtree = gtk.Builder()
 
        wtree.add_from_file(sibpath(__file__, "../light9/curvecalc/curvecalc.glade"))
 
        mainwin = wtree.get_object("MainWindow")
 
        mainwin.connect("destroy", gtk.main_quit)
 
        wtree.connect_signals(self)
 
        mainwin.show_all()
 
        #gobject.timeout_add(1000 // framerate, self.updateLoop)
 

	
 
def main():
 
    startTime = time.time()
 
    parser = optparse.OptionParser()
 
    parser.set_usage("%prog [opts] [songURI]")
 
    parser.add_option("--sliders", action='store_true',
 
                      help='use hardware sliders')
 
@@ -150,12 +161,24 @@ def main():
 
        song = URIRef(args[0])
 
    except IndexError:
 
        song = currentlyPlayingSong()
 

	
 
    music=Music()
 
    graph = makeGraph()
 

	
 
    start=Main()
 
    #gtk2reactor.install()
 

	
 
    if opts.startup_only:
 
        log.debug("quitting now because of --startup-only")
 
        return
 

	
 
    gtk.main()
 
    1/0
 
    ###################
 

	
 
    curveset = Curveset(sliders=opts.sliders)
 
    subterms = []
 

	
 
    subtermPath = graphPathForSubterms(song)
 
    try:
 
        graph.parse(subtermPath, format='n3')
 
@@ -168,22 +191,14 @@ def main():
 
    out = Output(subterms, music)
 

	
 
    musicfilename = showconfig.songOnDisk(song)
 
    maxtime = wavelength(musicfilename)
 
    dispatcher.connect(lambda: maxtime, "get max time", weak=False)
 

	
 

	
 
    root=tk.Tk()
 
    root.tk_setPalette("gray50")
 
    toplevelat("curvecalc",root)
 
    root.tk_focusFollowsMouse()
 
    root.title("curvecalc - %s" % graph.label(song))
 

	
 
    menubar = tk.Frame(root)
 
    menubar.pack(side='top', fill='x')
 

	
 
    if 'fixed top rows':
 
        zc = Zoomcontrol(root)
 
        zc.pack(side='top', fill='x')
 

	
 
    if 'panes':
 
        panes = tk.PanedWindow(root, height=1)
 
@@ -226,14 +241,8 @@ def main():
 
    
 
    # this is scheduled after some tk shuffling, to try to minimize
 
    # the number of times we redraw the curve at startup. If tk is
 
    # very slow, it's ok. You'll just get some wasted redraws.
 
    reactor.callLater(.1, curvesetView.goLive)
 

	
 
    tksupport.install(root, ms=10)
 
    log.debug("startup: run %s", time.time() - startTime)
 
    if opts.startup_only:
 
        log.debug("quitting now because of --startup-only")
 
        return
 
    prof.run(reactor.run, profile=False)
 

	
 
main()
light9/curvecalc/curvecalc.glade
Show inline comments
 
file renamed from light9/curvecalc/gladetest.glade to light9/curvecalc/curvecalc.glade
 
<?xml version="1.0" encoding="UTF-8"?>
 
<interface>
 
  <requires lib="gtk+" version="2.16"/>
 
  <!-- interface-naming-policy project-wide -->
 
  <object class="GtkTextBuffer" id="textbuffer1">
 
    <property name="text" translatable="yes">song01(t)</property>
 
  </object>
 
  <object class="GtkVBox" id="vbox2">
 
    <property name="visible">True</property>
 
    <property name="can_focus">False</property>
 
    <child>
 
      <object class="GtkImage" id="image1">
 
        <property name="width_request">289</property>
 
        <property name="height_request">120</property>
 
        <property name="visible">True</property>
 
        <property name="can_focus">False</property>
 
        <property name="stock">gtk-missing-image</property>
 
      </object>
 
      <packing>
 
        <property name="expand">False</property>
 
        <property name="fill">False</property>
 
        <property name="position">0</property>
 
      </packing>
 
    </child>
 
    <child>
 
      <object class="GtkLabel" id="label18">
 
        <property name="visible">True</property>
 
        <property name="can_focus">False</property>
 
        <property name="yalign">0.4699999988079071</property>
 
        <property name="label" translatable="yes">vidref from Sat 15:30</property>
 
      </object>
 
      <packing>
 
        <property name="expand">True</property>
 
        <property name="fill">True</property>
 
        <property name="position">1</property>
 
      </packing>
 
    </child>
 
  </object>
 
  <object class="GtkWindow" id="window1">
 
  <!-- interface-requires gtk+ 3.0 -->
 
  <object class="GtkWindow" id="MainWindow">
 
    <property name="can_focus">False</property>
 
    <child>
 
      <object class="GtkVBox" id="vbox1">
 
        <property name="visible">True</property>
 
        <property name="can_focus">False</property>
 
        <child>
 
          <object class="GtkMenuBar" id="menubar1">
 
            <property name="visible">True</property>
 
            <property name="can_focus">False</property>
 
            <property name="ubuntu_local">True</property>
 
            <child>
 
              <object class="GtkMenuItem" id="menuitem1">
 
                <property name="use_action_appearance">False</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="label" translatable="yes">_Curvecalc</property>
 
                <property name="use_underline">True</property>
 
                <child type="submenu">
 
                  <object class="GtkMenu" id="menu1">
 
                    <property name="visible">True</property>
 
                    <property name="can_focus">False</property>
 
                    <property name="ubuntu_local">True</property>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem2">
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                    <child>
 
                      <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
 
@@ -74,128 +37,127 @@
 
                        <property name="can_focus">False</property>
 
                      </object>
 
                    </child>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem5">
 
                        <property name="label">gtk-quit</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem10">
 
                        <property name="label">gtk-about</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                  </object>
 
                </child>
 
              </object>
 
            </child>
 
            <child>
 
              <object class="GtkMenuItem" id="menuitem7">
 
                <property name="use_action_appearance">False</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="label" translatable="yes">_Edit</property>
 
                <property name="use_underline">True</property>
 
                <child type="submenu">
 
                  <object class="GtkMenu" id="menu5">
 
                    <property name="visible">True</property>
 
                    <property name="can_focus">False</property>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem1">
 
                        <property name="label">gtk-cut</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem3">
 
                        <property name="label">gtk-copy</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                    <child>
 
                      <object class="GtkImageMenuItem" id="imagemenuitem4">
 
                        <property name="label">gtk-paste</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="use_underline">True</property>
 
                        <property name="use_stock">True</property>
 
                      </object>
 
                    </child>
 
                  </object>
 
                </child>
 
              </object>
 
            </child>
 
            <child>
 
              <object class="GtkMenuItem" id="menuitem2">
 
                <property name="use_action_appearance">False</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="label" translatable="yes">_View</property>
 
                <property name="use_underline">True</property>
 
              </object>
 
            </child>
 
            <child>
 
              <object class="GtkMenuItem" id="menuitem3">
 
                <property name="use_action_appearance">False</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="label" translatable="yes">_Playback</property>
 
                <property name="use_underline">True</property>
 
                <child type="submenu">
 
                  <object class="GtkMenu" id="menu3">
 
                    <property name="visible">True</property>
 
                    <property name="can_focus">False</property>
 
                    <property name="ubuntu_local">True</property>
 
                    <child>
 
                      <object class="GtkMenuItem" id="menuitem5">
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="label" translatable="yes">Play/pause</property>
 
                        <property name="use_underline">True</property>
 
                      </object>
 
                    </child>
 
                  </object>
 
                </child>
 
              </object>
 
            </child>
 
            <child>
 
              <object class="GtkMenuItem" id="menuitem4">
 
                <property name="use_action_appearance">False</property>
 
                <property name="visible">True</property>
 
                <property name="can_focus">False</property>
 
                <property name="use_action_appearance">False</property>
 
                <property name="label" translatable="yes">Poin_ts</property>
 
                <property name="use_underline">True</property>
 
                <child type="submenu">
 
                  <object class="GtkMenu" id="menu4">
 
                    <property name="visible">True</property>
 
                    <property name="can_focus">False</property>
 
                    <child>
 
                      <object class="GtkMenuItem" id="menuitem6">
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="visible">True</property>
 
                        <property name="can_focus">False</property>
 
                        <property name="use_action_appearance">False</property>
 
                        <property name="label" translatable="yes">menuitem6</property>
 
                        <property name="use_underline">True</property>
 
                      </object>
 
                    </child>
 
                  </object>
 
                </child>
 
@@ -232,14 +194,12 @@
 
                  <object class="GtkEntry" id="entry4">
 
                    <property name="visible">True</property>
 
                    <property name="can_focus">True</property>
 
                    <property name="invisible_char">●</property>
 
                    <property name="primary_icon_activatable">False</property>
 
                    <property name="secondary_icon_activatable">False</property>
 
                    <property name="primary_icon_sensitive">True</property>
 
                    <property name="secondary_icon_sensitive">True</property>
 
                  </object>
 
                  <packing>
 
                    <property name="expand">True</property>
 
                    <property name="fill">True</property>
 
                    <property name="position">1</property>
 
                  </packing>
 
@@ -296,12 +256,13 @@
 
                                      <object class="GtkHBox" id="hbox10">
 
                                        <property name="visible">True</property>
 
                                        <property name="can_focus">False</property>
 
                                        <child>
 
                                          <object class="GtkCheckButton" id="checkbutton3">
 
                                            <property name="label" translatable="yes">C</property>
 
                                            <property name="use_action_appearance">False</property>
 
                                            <property name="visible">True</property>
 
                                            <property name="can_focus">True</property>
 
                                            <property name="receives_default">False</property>
 
                                            <property name="use_action_appearance">False</property>
 
                                            <property name="draw_indicator">True</property>
 
                                          </object>
 
@@ -311,12 +272,13 @@
 
                                            <property name="position">0</property>
 
                                          </packing>
 
                                        </child>
 
                                        <child>
 
                                          <object class="GtkCheckButton" id="checkbutton4">
 
                                            <property name="label" translatable="yes">M</property>
 
                                            <property name="use_action_appearance">False</property>
 
                                            <property name="visible">True</property>
 
                                            <property name="can_focus">True</property>
 
                                            <property name="receives_default">False</property>
 
                                            <property name="use_action_appearance">False</property>
 
                                            <property name="draw_indicator">True</property>
 
                                          </object>
 
@@ -421,14 +383,12 @@
 
                          <object class="GtkEntry" id="entry1">
 
                            <property name="visible">True</property>
 
                            <property name="can_focus">True</property>
 
                            <property name="invisible_char">●</property>
 
                            <property name="primary_icon_activatable">False</property>
 
                            <property name="secondary_icon_activatable">False</property>
 
                            <property name="primary_icon_sensitive">True</property>
 
                            <property name="secondary_icon_sensitive">True</property>
 
                          </object>
 
                          <packing>
 
                            <property name="expand">True</property>
 
                            <property name="fill">True</property>
 
                            <property name="position">0</property>
 
                          </packing>
 
@@ -483,14 +443,12 @@
 
                          <object class="GtkEntry" id="entry2">
 
                            <property name="visible">True</property>
 
                            <property name="can_focus">True</property>
 
                            <property name="invisible_char">●</property>
 
                            <property name="primary_icon_activatable">False</property>
 
                            <property name="secondary_icon_activatable">False</property>
 
                            <property name="primary_icon_sensitive">True</property>
 
                            <property name="secondary_icon_sensitive">True</property>
 
                          </object>
 
                          <packing>
 
                            <property name="expand">True</property>
 
                            <property name="fill">True</property>
 
                            <property name="position">0</property>
 
                          </packing>
 
@@ -545,14 +503,12 @@
 
                          <object class="GtkEntry" id="entry3">
 
                            <property name="visible">True</property>
 
                            <property name="can_focus">True</property>
 
                            <property name="invisible_char">●</property>
 
                            <property name="primary_icon_activatable">False</property>
 
                            <property name="secondary_icon_activatable">False</property>
 
                            <property name="primary_icon_sensitive">True</property>
 
                            <property name="secondary_icon_sensitive">True</property>
 
                          </object>
 
                          <packing>
 
                            <property name="expand">True</property>
 
                            <property name="fill">True</property>
 
                            <property name="position">0</property>
 
                          </packing>
 
@@ -802,8 +758,43 @@
 
            <property name="position">3</property>
 
          </packing>
 
        </child>
 
      </object>
 
    </child>
 
  </object>
 
  <object class="GtkAccelGroup" id="accelgroup1"/>
 
  <object class="GtkTextBuffer" id="textbuffer1">
 
    <property name="text" translatable="yes">song01(t)</property>
 
  </object>
 
  <object class="GtkVBox" id="vbox2">
 
    <property name="visible">True</property>
 
    <property name="can_focus">False</property>
 
    <child>
 
      <object class="GtkImage" id="image1">
 
        <property name="width_request">289</property>
 
        <property name="height_request">120</property>
 
        <property name="visible">True</property>
 
        <property name="can_focus">False</property>
 
        <property name="stock">gtk-missing-image</property>
 
      </object>
 
      <packing>
 
        <property name="expand">False</property>
 
        <property name="fill">False</property>
 
        <property name="position">0</property>
 
      </packing>
 
    </child>
 
    <child>
 
      <object class="GtkLabel" id="label18">
 
        <property name="visible">True</property>
 
        <property name="can_focus">False</property>
 
        <property name="yalign">0.4699999988079071</property>
 
        <property name="label" translatable="yes">vidref from Sat 15:30</property>
 
      </object>
 
      <packing>
 
        <property name="expand">True</property>
 
        <property name="fill">True</property>
 
        <property name="position">1</property>
 
      </packing>
 
    </child>
 
  </object>
 
  <object class="GtkSizeGroup" id="sizegroup1"/>
 
</interface>
0 comments (0 inline, 0 general)