コード例 #1
0
 def Insert_New(self, sel, hit=None):
     # if OnIcon, add as a child
     if hit and \
        (( hit & CT.TREE_HITTEST_ONITEMICON ) != 0 ) :
         NewItem = self.AppendItem(sel, _(0, 'new'))
         self.Expand(NewItem)
     else:
         # if no node is selected, just add to the root
         if not (sel):
             sel = self.root
             NewItem = self.AppendItem(sel, _(0, 'new'))
         else:
             prev = self.GetPrevSibling(sel)
             if not (prev):
                 itemParent = self.GetItemParent(sel)
                 NewItem = self.PrependItem(itemParent, _(0, 'new'))
             else:
                 itemParent = self.GetItemParent(prev)
                 NewItem = self.InsertItem(itemParent, prev, _(0, 'new'))
             """
     NewItem = self.InsertItemBefore ( itemParent, sel, _(0,'new') )
     """
     self.Copy_PyData(sel, NewItem)
     self.SelectItem(NewItem, True)
     self.Edit(NewItem)
コード例 #2
0
ファイル: brick_Math.py プロジェクト: leevawns/pylab_works_3
    def After_Init(self):
        self.Caption = '+'
        # Define the input pins
        # <Pin-Name>, <Data_Type>, <Required>, <Description>
        self.Inputs[1] = [_(3, 'First Number'), TIO_NUMBER, True]
        self.Inputs[2] = [_(4, 'Second number'), TIO_NUMBER, True]

        # Define the output pins
        # <Pin-Name>, <Data_Type>, <Description>
        self.Outputs[1] = [_(5, 'Sum'), TIO_NUMBER]
コード例 #3
0
ファイル: brick_Math.py プロジェクト: leevawns/pylab_works_3
    def After_Init(self):
        self.Caption = _(8, 'DisplayNum')
        # Define the input pins
        self.Inputs[1] = [_(7, 'Number to display'), TIO_NUMBER]

        # Create the GUI controls
        CD = self.Create_Control(t_C_Static_Text)
        CD.Caption = _(9, 'Displayed Number')
        CD.FontSize = 40
        CD.FontColor = wx.BLUE
        CD.Input_Channel = 1
コード例 #4
0
ファイル: brick_Math.py プロジェクト: leevawns/pylab_works_3
    def After_Init(self):
        self.Caption = _(1, 'Number')
        # Define the output pins
        # <Pin-Name>, <Data_Type>, <Description>
        self.Outputs[1] = [_(1, 'Number'), TIO_NUMBER]

        # Create the GUI controls, Creation order is Display order
        # <control type>, self, <input channel or None>
        #    <caption>, <hinttext>,
        #       <value>, <range>, <other control specific information>
        # Create the GUI controls
        CD = self.Create_Control(t_C_Text_Control, _(1, 'Number'))
        CD.Value = str(0)  #self.Params[1] = str(0)
コード例 #5
0
  def On_Popup_Item_Selected ( self, event ) :
    ID = event.Int
    if ID == 0 :
      file = Ask_File_For_Save ( os.getcwd(),
                                 FileTypes = '*.tab',
                                 Title = _(0, 'Save Table as TAB-delimited file' ))
      if file :
        file = open ( file, 'w' )
        if self.table == self :
          GetValue = self.GetCellValue
        else :
          GetValue = self.table.GetValue

        for R in range ( self.table.GetNumberRows () ) :
          line = ''
          for C in range ( self.table.GetNumberCols () ) :
            line += str ( GetValue ( R, C ) ) +  '\t'
          file.write ( line +'\n')


        """ for R in range ( self.table.GetNumberRows () ) :
            line = ''
            for C in range ( self.table.GetNumberCols () ) :
              line += str ( self.table.GetValue ( R, C ) ) +  '\t'
            file.write ( line +'\n')
        else :
          for R in range ( self.GetNumberRows () ) :
            line = ''
            for C in range ( self.GetNumberCols () ) :
              line += str ( self.GetCellValue ( R, C ) ) +  '\t'
            file.write ( line +'\n')
        """
        file.close ()
コード例 #6
0
ファイル: brick_Math.py プロジェクト: leevawns/pylab_works_3
class t_Numeric_Control(tLWB_Brick):
    Description = _(10, 'User can enter a number')

    def After_Init(self):
        self.Caption = _(1, 'Number')
        # Define the output pins
        # <Pin-Name>, <Data_Type>, <Description>
        self.Outputs[1] = [_(1, 'Number'), TIO_NUMBER]

        # Create the GUI controls, Creation order is Display order
        # <control type>, self, <input channel or None>
        #    <caption>, <hinttext>,
        #       <value>, <range>, <other control specific information>
        # Create the GUI controls
        CD = self.Create_Control(t_C_Text_Control, _(1, 'Number'))
        CD.Value = str(0)  #self.Params[1] = str(0)

    def Generate_Output_Signals(self, In, Out, Par, XIn, XOut, XPar):
        if (Par[1] == ""):
            Out[1] = 0.0
        else:
            Out[1] = float(Par[1])


# ***********************************************************************
コード例 #7
0
 def Delete_Item(self, item):
     line = _(0,'Delete "' + self.GetItemText ( item ) + \
                '" and all its Children\n' \
                'Are you sure ?')
     if AskYesNo(line):
         # after deleting we want to got the element above it
         prev = self.GetPrevVisible(item)
         self.Delete(item)
         self.SelectItem(prev, True)
コード例 #8
0
def wbd(Brick, message):
    # the if-statement might be overdone,
    # but it allows to use "wbd" without testing it self
    if (not (Brick) or Brick.Diagnostic_Mode) and (len(message) > 0):
        line = ''
        if Brick:
            line = 6 * '*' + ' ' + _(0, 'WBD') + ': ('
            line += Brick.Name + ') = ' + Brick.Caption + ' : '
        line += message
        print(line)
コード例 #9
0
    def OnMenu_About(self, event):
        from wx.lib.wordwrap import wordwrap
        width = 450
        info = wx.adv.AboutDialogInfo()
        info.Name = 'PyLab Works'

        Path = sys._getframe().f_code.co_filename
        Path = os.path.split(Path)[0]
        info.SetIcon(
            wx.Icon(Joined_Paths(Path, '../pictures/ph_32.ico'),
                    wx.BITMAP_TYPE_ICO))
        info.Version = PG.Version_Nr
        info.Copyright = "(C) 2007 .. 2008 Stef Mientki"
        info.Description = wordwrap(
            _(
                0, 'PyLab_Works is easy to use, highly modular,'
                'visual development enviroment,'
                'specially aimed at education and (scientific) research.'),
            width, wx.ClientDC(self))
        info.WebSite = ("http://pic.flappie.nl/", "Home Page")

        info.Developers = [
            _(
                0, "Stef Mientki, special thanks to :\n"
                "\n"
                "the people who created Python\n"
                "[email protected]\n"
                "wxPython-users-list (especially Robin Dunn)\n"
                "and Erik Lechak for creating OGLlike.py")
        ]
        licenseText = "for all I added: BSD\n" \
          "Python: Python Software Foundation License (PSFL)\n" \
          "MatPlotLib: Python Software Foundation License (PSFL)\n" \
          "wxPython: L-GPL\n" \
          "openGL: Free Software Foundation License B (BSD / Mozilla)"
        info.License = wordwrap(licenseText, width, wx.ClientDC(self))
        wx.adv.AboutBox(info)
コード例 #10
0
ファイル: brick_Math.py プロジェクト: leevawns/pylab_works_3
class t_addition(tLWB_Brick):
    Description = _(2, 'Add two numbers')

    def After_Init(self):
        self.Caption = '+'
        # Define the input pins
        # <Pin-Name>, <Data_Type>, <Required>, <Description>
        self.Inputs[1] = [_(3, 'First Number'), TIO_NUMBER, True]
        self.Inputs[2] = [_(4, 'Second number'), TIO_NUMBER, True]

        # Define the output pins
        # <Pin-Name>, <Data_Type>, <Description>
        self.Outputs[1] = [_(5, 'Sum'), TIO_NUMBER]

    def Generate_Output_Signals(self, In, Out, Par, XIn, XOut, XPar):
        if In[1] and In[2]:
            Out[1] = In[1] + In[2]
コード例 #11
0
  def __init__ ( self, parent, table = None, name = 'Base Grid' ) :
    gridlib.Grid.__init__ ( self, parent, -1 )
    self.parent = parent
    self.My_Name = name
    # If used with a table,
    # most calls will be done to the table instead of the grid
    # WATCH OUT: not all calls are identical
    if table :
      self.table  = table
    else :
      self.table = self

    self.SetMargins ( 0, 0 )
    self.DefaultCellOverflow = False



    # *************************************************************
    # popup menus
    # *************************************************************
    pre = [ _(0, 'Export (tab delim)' ),
          ]
    self.Popup_Menu = My_Popup_Menu ( self.On_Popup_Item_Selected, None,
      pre = pre )
    self.Transparancy = 0
    self.Bind ( gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.On_Show_Popup )
    #self.Bind ( wx.EVT_CONTEXT_MENU, self.On_Show_Popup )
    # *************************************************************

    # ****************************************************************
    # EVENT BINDINGS
    # ****************************************************************
    #self.Bind ( gridlib.EVT_GRID_COL_SIZE,        self.OnColSize )
    self.Bind ( gridlib.EVT_GRID_EDITOR_SHOWN,    self.OnEditorShown )

    # EVT_GRID_EDITOR_HIDDEN is fired twice at the end of an edit session
    # while EVT_GRID_CELL_CHANGE is fired only once
    self.Bind ( gridlib.EVT_GRID_CELL_CHANGED,     self.OnEditorChange )

    self.Bind ( gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnLeftClick )
    if self.table != self :
      self.Bind ( gridlib.EVT_GRID_SELECT_CELL,     self.onCellSelected )
    self.Bind ( gridlib.EVT_GRID_EDITOR_CREATED,  self.onEditorCreated )
コード例 #12
0
from language_support import _
from help_support import Launch_CHM
__doc__ = """
"""

_Version_Text = [[
    1.3, '12-05-2008', 'Stef Mientki', 'Test Conditions:', (2, ), """
 - Help menu extended with chm-files and links from global config
"""
],
                 [
                     1.2, '20-11-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(
                         0, """
 - Create Menus bug solved
 - Create Menus now defined as a class, with more interfaces
""")
                 ],
                 [
                     1.1, '27-07-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(0, """
 - Some code restyling
 - Append_Item added
""")
                 ],
                 [
                     1.0, '14-07-2007', 'Stef Mientki', 'Test Conditions:', (),
                     _(0, ' - orginal release')
                 ]]
コード例 #13
0
    def __init__(self, ini=None):
        My_Frame_Class.__init__(self, None, 'Test of Control_Scope', ini)

        import copy
        import wx
        import wx.grid as gridlib
        #from   grid_support    import *
        from grid_support import MY_GRID_COL_TYPED, MY_GRID_ROW_FIXED, MY_GRID_TYPE_COLOR

        data_values = [[
            'Name', 'On', 'NumOn', 'Lower', 'Upper', 'AC', 'AC[s]', 'Delay[s]',
            'LineColor', 'LineWidth', 'World-1', 'Cal-1', 'World-2', 'Cal-2'
        ]]
        data_values_default = [
            'Signal i', False, True, -10, 10, False, 1, 0, (200, 0, 0), 2, 0,
            0, 1, 1
        ]

        for i in range(16):
            default = copy.copy(data_values_default)
            default[0] = ' Signal ' + str(i + 1) + ' [Volt]'
            A, B = 100, 255

            if i < 3:
                default[1] = True
                default[8] = ((i * A) % B, ((i + 1) * A) % B,
                              ((i + 2) * A) % B)
            data_values.append(default)  #14*[''])
        #print data_values
        data_types = [
            gridlib.GRID_VALUE_STRING, gridlib.GRID_VALUE_BOOL,
            gridlib.GRID_VALUE_BOOL, gridlib.GRID_VALUE_NUMBER,
            gridlib.GRID_VALUE_NUMBER, gridlib.GRID_VALUE_BOOL,
            gridlib.GRID_VALUE_NUMBER, gridlib.GRID_VALUE_NUMBER,
            MY_GRID_TYPE_COLOR, gridlib.GRID_VALUE_NUMBER,
            gridlib.GRID_VALUE_NUMBER, gridlib.GRID_VALUE_NUMBER,
            gridlib.GRID_VALUE_NUMBER, gridlib.GRID_VALUE_NUMBER
        ]
        data_defs = (MY_GRID_ROW_FIXED, MY_GRID_COL_TYPED)

        Image_List = Get_Image_List()
        bmp_Pause = Image_List.GetBitmap(49)
        bmp_Run = Image_List.GetBitmap(50)
        bmp_Plus = Image_List.GetBitmap(56)
        bmp_Minus = Image_List.GetBitmap(57)
        bmp_Up = Image_List.GetBitmap(45)
        bmp_Down = Image_List.GetBitmap(44)
        bmp_Color = Image_List.GetBitmap(48)

        b_size = (22, 22)
        GUI = """
    self.NB            ,wx.Notebook  ,style = wx.BK_LEFT
      self.Splitter      ,SplitterHor  ,name = 'Scope'  ,style = wx.NO_BORDER
        self.Panel_Left    ,wx.Panel
          B_Pause     ,BmpBut  ,bitmap = bmp_Pause  ,pos = (2,2)   ,size = b_size
          B_Run       ,BmpBut  ,bitmap = bmp_Run    ,pos = (2,27)  ,size = b_size
          B_Plus      ,BmpBut  ,bitmap = bmp_Plus   ,pos = (27,2)  ,size = b_size
          B_Minus     ,BmpBut  ,bitmap = bmp_Minus  ,pos = (27,27) ,size = b_size
          B_Up        ,BmpBut  ,bitmap = bmp_Up     ,pos = (52,2)  ,size = b_size
          B_Down      ,BmpBut  ,bitmap = bmp_Down   ,pos = (52,27) ,size = b_size
          B_Color     ,BmpBut  ,bitmap = bmp_Color  ,pos = (77,2)  ,size = b_size
          self.Sel_Signal  ,wx.StaticText, label = '--', pos = ( 77, 27 )
        self.Panel_Right   ,wx.Panel
          self.Scope       ,tBase_Scope_with_History
      self.Grid          ,Base_Table_Grid  ,data_values, data_types, data_defs, name='Settings'
    """
        self.wxGUI = Create_wxGUI(GUI)
        print(self.wxGUI.code)

        self.Panel_Left.SetBackgroundColour(wx.BLACK)

        B_Pause.SetToolTipString(_(0, 'Pause Recording'))
        B_Run.SetToolTipString(_(0, 'Start Recording'))
        B_Plus.SetToolTipString(_(0, 'Increase selected signal Amplitude'))
        B_Minus.SetToolTipString(_(0, 'Decrease selected signal Amplitude'))
        B_Up.SetToolTipString(_(0, 'Shift selected signal Up'))
        B_Down.SetToolTipString(_(0, 'Shift selected signal Down'))
        B_Color.SetToolTipString(_(0, 'Set Color of selected signal'))

        self.Sel_Signal.SetForegroundColour(wx.WHITE)
        self.Sel_Signal.SetToolTipString(_(0, 'Selected Signal'))

        Set_NoteBook_Images(self.NB, (47, 67))

        wx.CallLater(wxGUI_Delay, self.Splitter.SetSashPosition, 102)
コード例 #14
0
# ***********************************************************************


# ***********************************************************************
# ***********************************************************************
_Version_Text = [

[ 1.3, '29-04-2009', 'Stef Mientki',
'Test Conditions:', (2,) ,
"""
- Get_Relative_Path and Get_Rel_Path required that the file existed, not anymore
""" ],

[ 1.2, '05-03-2009', 'Stef Mientki',
'Test Conditions:', (2,) , _(0, """
  - Find_Files now leaves svn directories untouched
""") ],

[ 1.1, '05-02-2009', 'Stef Mientki',
'Test Conditions:', (2,) , _(0, """
  - Find_Files now removes empty filenames
""") ],

[ 1.0, '17-01-2009', 'Stef Mientki',
'Test Conditions:', (2,) , _(0, """
  - Get_Rel_Path   added
  - Get_Abs_Path   added
""") ],

[ 0.9, '21-12-2008', 'Stef Mientki',
'Test Conditions:', (2,) , _(0, """
コード例 #15
0
#from language_support import  _
from language_support import  _, Language_Current, Set_Language, Flag_Object

__doc__ = """
"""

_Version_Text = [

[ 1.2 , '13-10-2008', 'Stef Mientki',
'Test Conditions:', (2,),
_(0, """
 - In Notebook creation, removed the imageId, gave problems under Ubuntu
 - changed name of GUI_NoteBook to GUI_Notebook
 - my_MiniFrame removed (it's better to maintain just one: My_Frame_Class)
""")],

[ 1.1 , '27-08-2008', 'Stef Mientki',
'Test Conditions:', (2,),
_(0, """
 - GUI_NoteBook added
""")],

[ 1.0 , '14-07-2007', 'Stef Mientki',
'Test Conditions:', (),
_(0, ' - orginal release')]
]


# !!! import wx before any support library !!!
# otherwise the IDE won't do auto-suggest
import wx
import wx.lib.flatnotebook as fnb
コード例 #16
0
ファイル: doc_support.py プロジェクト: leevawns/pylab_works_3
# ***********************************************************************


# ***********************************************************************
from General_Globals import *
from language_support import _
# ***********************************************************************


# ***********************************************************************
# ***********************************************************************
_Version_Text = [
[ 0.1, '28-07-2008', 'Stef Mientki',
'Test Conditions:', (2,),
_(0, """
    - orginal release
""" ) ]
]
# ***********************************************************************


import os
#import inspect
from inspect import *
import pyclbr


# ***********************************************************************
# ***********************************************************************
def Get_Classes_And_Functions ( my_module, my_paths = [] ):
コード例 #17
0
import sys
subdirs = [
  '../support',
  ]
for subdir in subdirs:
  if not ( subdir in sys.path) : sys.path.append ( subdir )
# ***********************************************************************
"""
from language_support import _

# ***********************************************************************
_Version_Text = [[
    1.1, '04-09-2008', 'Stef Mientki', 'Test Conditions:', (2, ),
    _(
        0, """
 - Read_SenseWear_Tab_File, extended with Sample_Reduction argument
 - Read_SenseWear_Tab_File, improved print info (including missing samples)
""")
],
                 [
                     1.0, '14-07-2007', 'Stef Mientki', 'Test Conditions:',
                     (1, ),
                     _(0, ' - orginal release')
                 ]]
# ***********************************************************************

from scipy import signal  #*   # you may not use "scipy."
from numpy import *
import os  # filesize
from struct import *  # pack
from datetime import *
コード例 #18
0
import __init__

# ***********************************************************************
from General_Globals import *
from language_support import _

_Version_Text = [[
    1.1, '5-09-2008', 'Stef Mientki', 'Test Conditions:', (2, ),
    _(
        0, """
 - added unpacking, to merge a tupple of unequal length elements)
""")
],
                 [
                     1.0, '14-07-2007', 'Stef Mientki', 'Test Conditions:',
                     (1, ),
                     _(0, ' - orginal release')
                 ]]
# ***********************************************************************

from numpy import *

#from utility_support import s_list


# ***********************************************************************
# ***********************************************************************
class class_MetaData(object):
    def Get(self, Attrib, Default):
        try:
            return getattr(self, Attrib)
コード例 #19
0
import __init__

from language_support import _

# ***********************************************************************
__doc__ = _(0, """
doc_string translated ?
""")
# ***********************************************************************
_Version_Text = [[
    0.1, '04-11-2008', 'Stef Mientki', 'Test Conditions:', (2, ),
    _(0, ' - orginal release')
]]
# ***********************************************************************
_ToDo = """
"""
# ***********************************************************************

from General_Globals import *
import win32gui
import win32api
import win32con
import fnmatch


# ***********************************************************************
# ***********************************************************************
def Find_Window(Name):
    return win32gui.FindWindow(None, Name)

コード例 #20
0
_Version_Text = [

[ 2.2 , '10-04-2009', 'Stef Mientki',
'Test Conditions:', (2,),
"""
- Color type cells, didn't color upon init, bug fixed
""" ],


[ 2.1 , '27-07-2008', 'Stef Mientki',
'Test Conditions:', (2,),
_(0, """
 - New Base_Grid should be used as the base of all Grids
 - Added Get_Settings and Do_Settings,
   to save and reload the user settings in an config file
 - Setting Column Attributes improved to work around bug in wxPython
 - Added faciltity to define a set of attributes and
   to use them with new procedures for setting Cell, Row and Col Attributes
 - export Grid data to a tab-delimited file, through RM-menu
""")],

[ 2.0 , '10-12-2007', 'Stef Mientki',
'Test Conditions:', (),
_(0, '  - changed behavior of STAY ON TOP properties form')],

[ 1.0 , '14-07-2007', 'Stef Mientki',
'Test Conditions:', (),
_(0, ' - orginal release')]
]
# ***********************************************************************
コード例 #21
0
__doc__ = """
License: freeware, under the terms of the BSD-license
Copyright (C) 2008 Stef Mientki
mailto:[email protected]
"""

_Version_Text = [[
    1.4, '11-04-2009', 'Stef Mientki', 'Test Conditions:', (3, ), """
 - Color_Dialog now alwaays returns None, if canceled
"""
],
                 [
                     1.3, '06-12-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(
                         0, """
 - Multiline dialog, if just 1 preset item, OK-button gets focus
""")
                 ],
                 [
                     1.2, '23-11-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(
                         0, """
 - ColorDialog added
 - Ask_File_For_Save, now also accepts an integer for the filetype
""")
                 ],
                 [
                     1.1, '10-03-2008', 'Stef Mientki', 'Test Conditions:', (),
                     _(0, ' - AskYesNo, now returns True or False')
                 ],
コード例 #22
0
import __init__

# ***********************************************************************
from language_support import _
from General_Globals import *
# ***********************************************************************

# ***********************************************************************
_Version_Text = [[
    1.1, '31-09-2008', 'Stef Mientki', 'Test Conditions:', (2, ),
    _(0, ' - Get_CallTip_Completion  added')
],
                 [
                     1.0, '28-09-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(0, ' - orginal release')
                 ]]
# ***********************************************************************

# ***********************************************************************
#from visual import *
#import visual

import rlcompleter
from inspect import *

Special_Imports = {
    'DOM': ['pyjamas'],
    'pyjamas': ['pyjamas', 'pyjamas.ui'],
    'wx': ['wx.gizmos', 'wx.grid', 'wx.lib', 'wx.stc'],
    'stc': ['wx.stc as stc']
コード例 #23
0
class My_Popup_Menu(wx.Menu):

    default = {}

    # edit
    default[0] = [_(0, 'Cut'), _(0, 'Copy'), _(0, 'Paste'), _(0, 'Delete')]

    # extended edit
    default[1] = [
        '-',
        _(0, 'Cut'),
        _(0, 'Copy'),
        _(0, 'Paste'),
        _(0, 'Delete'), '-'
    ]

    # tree
    default[2] = [
        _(0, 'Insert New\tIns'),
        _(0, 'Edit\tSpace'), '-',
        _(0, 'Cut\tCtrl-X'),
        _(0, 'Copy\tCtrl-C'),
        _(0, 'Paste\tCtrl-V'),
        _(0, 'Delete\tDel')
    ]

    # *************************************************************
    # itemset = None,  doesn't use a default set
    # *************************************************************
    def __init__(self, OnSelect, itemset=0, pre=None, post=None):
        wx.Menu.__init__(self)

        # Determine the itemlist = pre + set + after
        items = []
        if pre:
            items = pre
        if isinstance(itemset, int):
            items += self.default[itemset]
        if post:
            items += post

        # generate the menu
        self.IDs = []
        self.items = []
        for text in items:
            if text == '-':
                item = self.AppendSeparator()
            else:
                item = self.Append(wx.ID_ANY, text)

                # order of these bindings is important
                # to be sure we get it first
                self.Bind(wx.EVT_MENU, OnSelect, item)
                self.Bind(wx.EVT_MENU, self.OnSelect, item)

                # only save IDs of real items
                self.IDs.append(item.GetId())
                self.items.append(item)

            #UBUNTU problems: item.SetCheckable ( True )

    # *************************************************************
    # *************************************************************
    def Append_Item(self, item):
        self.AppendItem(item)
        #UBUNTU problems: item.SetCheckable ( True )

    # *************************************************************
    # *************************************************************
    def Get_Index_by_ID(self, ID_sel):
        for i, ID in enumerate(self.IDs):
            if ID == ID_sel:
                break
        return i

    # *************************************************************
    # *************************************************************
    def Get_Item_by_ID(self, ID_sel):
        i = self.Get_Index_by_ID(ID_sel)
        return self.items[i]

    # *************************************************************
    # *************************************************************
    def OnSelect(self, event):
        ID_sel = event.GetId()
        for i, ID in enumerate(self.IDs):
            if ID == ID_sel:
                break
        # return the index
        # event.Int is only used in very special cases (what?)
        # so it's valid to use it here to transport the index
        event.Int = i
        event.Skip()

    # *************************************************************
    # *************************************************************
    def SetEnabled(self, index, value=True):
        ID = self.IDs[index]
        value = bool(value)
        self.Enable(ID, value)

    # *************************************************************
    # *************************************************************
    def SetChecked(self, index, value=True):
        item = self.items[index]
        if (item.IsCheckable()):
            item.SetCheckable(True)
            if value:
                item.Check(True)
            else:
                item.Check(False)
コード例 #24
0
    def __init__(self,
                 parent,
                 root_title=_(0, 'No Root Title'),
                 name='CT-Tree',
                 No_Image_List=False,
                 style_add=None,
                 style_sub=None):

        self.parent = parent

        # *************************************************************
        # tree style to be used
        # *************************************************************
        tree_style = \
                      CT.TR_HAS_BUTTONS \
                     | CT.TR_FULL_ROW_HIGHLIGHT \
                     | CT.TR_HIDE_ROOT \
                     | CT.TR_LINES_AT_ROOT \
                     | CT.TR_SINGLE \
                     | CT.TR_EDIT_LABELS \
                     | wx.WANTS_CHARS \
                     | CT.TR_HAS_VARIABLE_ROW_HEIGHT \
                     | wx.NO_BORDER \
                 #| wx.SUNKEN_BORDER \

        if style_add:
            tree_style |= style_add
        if style_sub:
            tree_style ^= style_sub

        # *************************************************************
        # create the tree and assign imagelist
        # *************************************************************
        CT.CustomTreeCtrl_Modified_SM.__init__(self,
                                               parent,
                                               style=tree_style,
                                               name=name)
        self.No_Image_List = No_Image_List

        self.root = self.AddRoot(root_title)
        if not (self.No_Image_List):
            self.imagelist = Get_Image_List()
            self.SetImageList(self.imagelist)
        self.Item_Copy = False
        self.Move_Action = False

        #self.DeleteAllItems()
        #self.root

        # we also give the root images, so we can use it as copy source
        PyData = []
        PyData.append(0)
        PyData.append(78)
        PyData.append(79)
        self.SetPyData(self.root, PyData)

        # *************************************************************
        # popup menus
        # *************************************************************
        PU = My_Popup_Menu(self.OnPopupItemSelected, 2)
        self.Popup_Menu_Tree = PU

        #self.Bind ( wx.EVT_CONTEXT_MENU, self.OnShowPopup )
        #In Ubuntu context menu doesn't appear
        #self.Bind ( wx.EVT_RIGHT_DOWN, self.OnShowPopup )
        #self.Bind ( wx.EVT_RIGHT_UP, self.OnShowPopup )
        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnShowPopup)
        """
    default[2] = [
      'Insert New\tIns', 'Edit',
      '-', 'Cut\tCtrl-X', 'Copy\tCtrl-C', 'Paste\tCtrl-V', 'Delete\tDel' ]
    """
        self.Popup_Menu_Tree.SetEnabled(4, self.Item_Copy)

        # Create Bindings for the menu events
        self.Bind(wx.EVT_MENU, self.On_Insert, PU.items[0])  # Ins
        self.Bind(wx.EVT_MENU, self.On_Edit, PU.items[1])  # Ins
        self.Bind(wx.EVT_MENU, self.On_Cut, PU.items[2])  # ^X
        self.Bind(wx.EVT_MENU, self.On_Copy, PU.items[3])  # ^C
        self.Bind(wx.EVT_MENU, self.On_Paste, PU.items[4])  # ^V
        self.Bind(wx.EVT_MENU, self.On_Delete, PU.items[5])  # Del

        # Create bindings for accelerator keys
        aTable = wx.AcceleratorTable ( [ \
            ( wx.ACCEL_NORMAL, wx.WXK_INSERT, PU.IDs[0] ),
            #( wx.ACCEL_NORMAL, wx.WXK_SPACE,  PU.IDs[1] ),
            ( wx.ACCEL_CTRL,   ord('X'),      PU.IDs[2] ),
            ( wx.ACCEL_CTRL,   ord('C'),      PU.IDs[3] ),
            ( wx.ACCEL_CTRL,   ord('V'),      PU.IDs[4] ),
            #( wx.ACCEL_NORMAL, wx.WXK_DELETE, PU.IDs[5] ),
            ])
        self.SetAcceleratorTable(aTable)

        # *************************************************************
        # Event Bindings
        # *************************************************************
        self.Bind(wx.EVT_NAVIGATION_KEY, self.OnTreeNavigate)

        self.Bind(wx.EVT_KEY_DOWN, self.OnMyKeyDown)

        self.Bind(CT.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag)
        self.Bind(CT.EVT_TREE_END_DRAG, self.OnEndDrag)

        self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)

        # *************************************************************
        # Event Bindings, Not Used in this library
        # *************************************************************
        """
    self.Bind ( CT.EVT_TREE_ITEM_GETTOOLTIP,  self.OnToolTip )

    self.Bind ( wx.EVT_KEY_DOWN,              self.OnKeyDown )
    self.Bind ( CT.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginEdit )

    self.Bind ( wx.EVT_MIDDLE_DOWN,           self.OnMiddleDown )
    self.Bind ( wx.EVT_RIGHT_DOWN,            self.OnRightDown )

    self.Bind ( CT.EVT_TREE_SEL_CHANGED,      self.OnChanged )
    self.Bind ( CT.EVT_TREE_SEL_CHANGING,     self.OnChanging )
    self.Bind ( CT.EVT_TREE_ITEM_ACTIVATED,   self.OnActivated )
    self.Bind ( CT.EVT_TREE_STATE_IMAGE_CLICK,self.OnActivated )
    """

        self.Bind(CT.EVT_TREE_SEL_CHANGED, self.On_Sel_Changed)
コード例 #25
0
from language_support import _

# ***********************************************************************
__doc__ = """
blabla

License: freeware, under the terms of the BSD-license
Copyright (C) 2008 Stef Mientki
mailto:[email protected]
"""

# ***********************************************************************
_Version_Text = [[
    1.1, '10-10-2008', 'Stef Mientki', 'Test Conditions:', (),
    _(0, """
  - Read_PuntHoofd_Tree added
""")
],
                 [
                     1.0, '10-03-2008', 'Stef Mientki', 'Test Conditions:', (),
                     _(0, """
    - orginal release
""")
                 ]]
# ***********************************************************************

# ***********************************************************************
# ***********************************************************************
import webbrowser

# ***********************************************************************
コード例 #26
0
import __init__


from language_support import  _
__doc__ = _(0, """
Scintilla Templates Manager,
License: freeware, under the terms of the BSD-license
Copyright (C) 2007 Stef Mientki
mailto:[email protected]
""" )

# ***********************************************************************
_Version_Text = [

[ 1.1 , '01-01-2008', 'Stef Mientki',
'Test Conditions:', ( 1, ),
_(0, '- if editor open, follow the highlighted item')],


[ 1.0 , '21-12-2007', 'Stef Mientki',
'Test Conditions:', ( 1, ),
_(0, ' - original release')]
]
# ***********************************************************************


# ***********************************************************************
import  wx
import  wx.lib.newevent

from   inifile_support import inifile
コード例 #27
0
#icon = vippi_bricks_323.png
## Version - header
# If the module has run standalone and
# is located in a different path from language_support
# be sure we can reach language_support
import __init__

from language_support import _

__doc__ = _(0, """
Doc string
""")

_Version_Text = [[
    1.0, '32-10-2008', 'Stef Mientki', 'Test Conditions:', (
        2,
        3,
    ),
    _(0, ' - original release')
]]
# ***********************************************************************
_ToDo = """
"""
from General_Globals import *

# ***********************************************************************


## Main GUI
# ***********************************************************************
# ***********************************************************************
コード例 #28
0
# ***********************************************************************
__doc__ = """
TreeControl with drag and drop, RM-menu, etc
based on CT.CustomTreeCtrl

License: freeware, under the terms of the BSD-license
Copyright (C) 2008 Stef Mientki
mailto:[email protected]
"""

# ***********************************************************************
_Version_Text = [
    [
        1.6, '13-10-2008', 'Stef Mientki', 'Test Conditions:', (),
        _(0, """
 - CollapseAll added
""")
    ],
    [
        1.5, '10-10-2008', 'Stef Mientki', 'Test Conditions:', (),
        _(0, """
 - Autoread of JALcc trees added
""")
    ],
    [
        1.4, '29-07-2008', 'Stef Mientki', 'Test Conditions:', (),
        _(0, """
   - Lines_2_Tree     added
   - Add_PyFile_Info  added
""")
    ],
コード例 #29
0
ファイル: wxp_widgets.py プロジェクト: leevawns/pylab_works_3
subdirs = [ '../support' ]
for subdir in subdirs:
  if not ( subdir in sys.path) : sys.path.append ( subdir )
"""

from General_Globals import *
from language_support import _

__doc__ = """
"""

# ***********************************************************************
_Version_Text = [[
    1.2, '19-10-2008', 'Stef Mientki', 'Test Conditions:', (2, ),
    _(
        0, """
 - Translate_CSS, improved by replacing unnessary paragraph tags
""")
],
                 [
                     1.1, '10-10-2008', 'Stef Mientki', 'Test Conditions:',
                     (2, ),
                     _(
                         0, """
 - callback to parent implemented, still needs some improvement
 - started with implementation of PW, bitmapbutton, not ready yet
 - Translate_CSS, if source file not available, creates an html error page
""")
                 ],
                 [
                     1.0, '14-03-2008', 'Stef Mientki', 'Test Conditions:', (),
                     _(0, ' - orginal release')
コード例 #30
0

##-

## Version - header
# ***********************************************************************
"""
If the module has run standalone and
is located in a different path from language_support
be sure we can reach language_support
"""
import __init__

from language_support import  _
__doc__ = _(0,"""
Doc string
""")

_Version_Text = [
[ 1.0 , '32-10-2008', 'Stef Mientki',
'Test Conditions:', ( 2,3, ),
_(0, ' - original release')]
]

from General_Globals import *
# ***********************************************************************

## Main GUI
# ***********************************************************************
# ***********************************************************************
class Simple_Test_Form ( My_Frame_Class ):