예제 #1
0
파일: actions.py 프로젝트: gsathya/arm
def makeViewMenu():
  """
  Submenu consisting of...
    [X] <Page 1>
    [ ] <Page 2>
    [ ] etc...
        Color (Submenu)
  """
  
  viewMenu = cli.menu.item.Submenu("View")
  control = cli.controller.getController()
  
  if control.getPageCount() > 0:
    pageGroup = cli.menu.item.SelectionGroup(control.setPage, control.getPage())
    
    for i in range(control.getPageCount()):
      pagePanels = control.getDisplayPanels(pageNumber = i, includeSticky = False)
      label = " / ".join([str_tools.to_camel_case(panel.getName()) for panel in pagePanels])
      
      viewMenu.add(cli.menu.item.SelectionMenuItem(label, pageGroup, i))
  
  if uiTools.isColorSupported():
    colorMenu = cli.menu.item.Submenu("Color")
    colorGroup = cli.menu.item.SelectionGroup(uiTools.setColorOverride, uiTools.getColorOverride())
    
    colorMenu.add(cli.menu.item.SelectionMenuItem("All", colorGroup, None))
    
    for color in uiTools.COLOR_LIST:
      colorMenu.add(cli.menu.item.SelectionMenuItem(str_tools.to_camel_case(color), colorGroup, color))
    
    viewMenu.add(colorMenu)
  
  return viewMenu
예제 #2
0
파일: actions.py 프로젝트: lnrsoft/arm
def makeGraphMenu(graphPanel):
    """
  Submenu for the graph panel, consisting of...
    [X] <Stat 1>
    [ ] <Stat 2>
    [ ] <Stat 2>
        Resize...
        Interval (Submenu)
        Bounds (Submenu)
  
  Arguments:
    graphPanel - instance of the graph panel
  """

    graphMenu = cli.menu.item.Submenu("Graph")

    # stats options
    statGroup = cli.menu.item.SelectionGroup(graphPanel.setStats,
                                             graphPanel.getStats())
    availableStats = graphPanel.stats.keys()
    availableStats.sort()

    for statKey in ["None"] + availableStats:
        label = str_tools.to_camel_case(statKey, divider=" ")
        statKey = None if statKey == "None" else statKey
        graphMenu.add(
            cli.menu.item.SelectionMenuItem(label, statGroup, statKey))

    # resizing option
    graphMenu.add(cli.menu.item.MenuItem("Resize...", graphPanel.resizeGraph))

    # interval submenu
    intervalMenu = cli.menu.item.Submenu("Interval")
    intervalGroup = cli.menu.item.SelectionGroup(
        graphPanel.setUpdateInterval, graphPanel.getUpdateInterval())

    for i in range(len(cli.graphing.graphPanel.UPDATE_INTERVALS)):
        label = cli.graphing.graphPanel.UPDATE_INTERVALS[i][0]
        label = str_tools.to_camel_case(label, divider=" ")
        intervalMenu.add(
            cli.menu.item.SelectionMenuItem(label, intervalGroup, i))

    graphMenu.add(intervalMenu)

    # bounds submenu
    boundsMenu = cli.menu.item.Submenu("Bounds")
    boundsGroup = cli.menu.item.SelectionGroup(graphPanel.setBoundsType,
                                               graphPanel.getBoundsType())

    for boundsType in cli.graphing.graphPanel.Bounds:
        boundsMenu.add(
            cli.menu.item.SelectionMenuItem(boundsType, boundsGroup,
                                            boundsType))

    graphMenu.add(boundsMenu)

    return graphMenu
예제 #3
0
파일: actions.py 프로젝트: gsathya/arm
def makeGraphMenu(graphPanel):
  """
  Submenu for the graph panel, consisting of...
    [X] <Stat 1>
    [ ] <Stat 2>
    [ ] <Stat 2>
        Resize...
        Interval (Submenu)
        Bounds (Submenu)
  
  Arguments:
    graphPanel - instance of the graph panel
  """
  
  graphMenu = cli.menu.item.Submenu("Graph")
  
  # stats options
  statGroup = cli.menu.item.SelectionGroup(graphPanel.setStats, graphPanel.getStats())
  availableStats = graphPanel.stats.keys()
  availableStats.sort()
  
  for statKey in ["None"] + availableStats:
    label = str_tools.to_camel_case(statKey, divider = " ")
    statKey = None if statKey == "None" else statKey
    graphMenu.add(cli.menu.item.SelectionMenuItem(label, statGroup, statKey))
  
  # resizing option
  graphMenu.add(cli.menu.item.MenuItem("Resize...", graphPanel.resizeGraph))
  
  # interval submenu
  intervalMenu = cli.menu.item.Submenu("Interval")
  intervalGroup = cli.menu.item.SelectionGroup(graphPanel.setUpdateInterval, graphPanel.getUpdateInterval())
  
  for i in range(len(cli.graphing.graphPanel.UPDATE_INTERVALS)):
    label = cli.graphing.graphPanel.UPDATE_INTERVALS[i][0]
    label = str_tools.to_camel_case(label, divider = " ")
    intervalMenu.add(cli.menu.item.SelectionMenuItem(label, intervalGroup, i))
  
  graphMenu.add(intervalMenu)
  
  # bounds submenu
  boundsMenu = cli.menu.item.Submenu("Bounds")
  boundsGroup = cli.menu.item.SelectionGroup(graphPanel.setBoundsType, graphPanel.getBoundsType())
  
  for boundsType in cli.graphing.graphPanel.Bounds:
    boundsMenu.add(cli.menu.item.SelectionMenuItem(boundsType, boundsGroup, boundsType))
  
  graphMenu.add(boundsMenu)
  
  return graphMenu
예제 #4
0
파일: actions.py 프로젝트: lnrsoft/arm
def makeViewMenu():
    """
  Submenu consisting of...
    [X] <Page 1>
    [ ] <Page 2>
    [ ] etc...
        Color (Submenu)
  """

    viewMenu = cli.menu.item.Submenu("View")
    control = cli.controller.getController()

    if control.getPageCount() > 0:
        pageGroup = cli.menu.item.SelectionGroup(control.setPage,
                                                 control.getPage())

        for i in range(control.getPageCount()):
            pagePanels = control.getDisplayPanels(pageNumber=i,
                                                  includeSticky=False)
            label = " / ".join([
                str_tools.to_camel_case(panel.getName())
                for panel in pagePanels
            ])

            viewMenu.add(cli.menu.item.SelectionMenuItem(label, pageGroup, i))

    if uiTools.isColorSupported():
        colorMenu = cli.menu.item.Submenu("Color")
        colorGroup = cli.menu.item.SelectionGroup(uiTools.setColorOverride,
                                                  uiTools.getColorOverride())

        colorMenu.add(cli.menu.item.SelectionMenuItem("All", colorGroup, None))

        for color in uiTools.COLOR_LIST:
            colorMenu.add(
                cli.menu.item.SelectionMenuItem(str_tools.to_camel_case(color),
                                                colorGroup, color))

        viewMenu.add(colorMenu)

    return viewMenu
예제 #5
0
파일: str_tools.py 프로젝트: abcdef123/stem
 def test_to_camel_case(self):
   """
   Checks the to_camel_case() function.
   """
   
   # test the pydoc example
   self.assertEquals("I Like Pepperjack!", str_tools.to_camel_case("I_LIKE_PEPPERJACK!"))
   
   # check a few edge cases
   self.assertEquals("", str_tools.to_camel_case(""))
   self.assertEquals("Hello", str_tools.to_camel_case("hello"))
   self.assertEquals("Hello", str_tools.to_camel_case("HELLO"))
   self.assertEquals("Hello  World", str_tools.to_camel_case("hello__world"))
   self.assertEquals("Hello\tworld", str_tools.to_camel_case("hello\tWORLD"))
   self.assertEquals("Hello\t\tWorld", str_tools.to_camel_case("hello__world", "_", "\t"))
예제 #6
0
    def test_to_camel_case(self):
        """
    Checks the to_camel_case() function.
    """

        # test the pydoc example
        self.assertEquals("I Like Pepperjack!",
                          str_tools.to_camel_case("I_LIKE_PEPPERJACK!"))

        # check a few edge cases
        self.assertEquals("", str_tools.to_camel_case(""))
        self.assertEquals("Hello", str_tools.to_camel_case("hello"))
        self.assertEquals("Hello", str_tools.to_camel_case("HELLO"))
        self.assertEquals("Hello  World",
                          str_tools.to_camel_case("hello__world"))
        self.assertEquals("Hello\tworld",
                          str_tools.to_camel_case("hello\tWORLD"))
        self.assertEquals("Hello\t\tWorld",
                          str_tools.to_camel_case("hello__world", "_", "\t"))