Beispiel #1
0
    def main(self):
        # These lines create the form and populate it with widgets.
        # A fairly complex screen in only 8 or so lines of code - a line for each control.
        F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
        f = F.add(npyscreen.TitleFixedText,
                  name="Fixed Text:",
                  value="This is fixed text")
        t = F.add(
            npyscreen.TitleText,
            name="Text:",
        )
        p = F.add(npyscreen.TitlePassword, name="Password:"******"Filename:")
        dt = F.add(npyscreen.TitleDateCombo, name="Date:")
        cb = F.add(npyscreen.Checkbox, name="A Checkbox")
        s = F.add(npyscreen.TitleSlider, out_of=12, name="Slider")
        ml = F.add(
            npyscreen.MultiLineEdit,
            value=
            """try typing here! Mutiline text, press ^R to reformat.\nPress ^X for automatically created list of menus""",
            max_height=5,
            rely=9)
        ms = F.add(npyscreen.TitleSelectOne,
                   max_height=4,
                   value=[
                       1,
                   ],
                   name="Pick One",
                   values=["Option1", "Option2", "Option3"],
                   scroll_exit=True,
                   width=30)
        ms2 = F.add(npyscreen.MultiSelect,
                    max_height=4,
                    value=[
                        1,
                    ],
                    values=["Option1", "Option2", "Option3"],
                    scroll_exit=True,
                    width=20)

        bn = F.add(
            npyscreen.MiniButton,
            name="Button",
        )

        #gd = F.add(npyscreen.SimpleGrid, relx = 42, rely=15, width=20)
        gd = F.add(npyscreen.GridColTitles,
                   relx=42,
                   rely=15,
                   width=20,
                   col_titles=['1', '2', '3', '4'])
        gd.values = []
        for x in range(36):
            row = []
            for y in range(x, x + 36):
                row.append(y)
            gd.values.append(row)

        # This lets the user play with the Form.
        F.edit()
    def main(self):
        # These lines create the form and populate it with widgets.
        # A fairly complex screen in only 8 or so lines of code - a line for each control.
        npyscreen.setTheme(npyscreen.Themes.BlackOnWhiteTheme)
        F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
        t = F.add(
            npyscreen.TitleText,
            name="Text:",
        )
        fn = F.add(npyscreen.TitleFilename, name="Filename:")
        dt = F.add(npyscreen.TitleDateCombo, name="Date:")
        s = F.add(npyscreen.TitleSlider, out_of=12, name="Slider")
        ml = F.add(
            npyscreen.MultiLineEdit,
            value="""try typing here! Mutiline text, press ^R to reformat.\n""",
            max_height=5,
            rely=9)
        ms = F.add(npyscreen.TitleSelectOne,
                   max_height=4,
                   value=[
                       1,
                   ],
                   name="Pick One",
                   values=["Option1", "Option2", "Option3"],
                   scroll_exit=True)

        # This lets the user play with the Form.
        F.edit()
Beispiel #3
0
    def main(self):
        # These lines create the form and populate it with widgets.
        # A fairly complex screen in only 8 or so lines of code - a line for each control.
        npyscreen.setTheme(npyscreen.Themes.ColorfulTheme)
        F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
        t1 = F.add(
            self.__class__.__TEXT_WIDGET,
            name="Text:",
        )
        t2 = F.add(
            self.__class__.__TEXT_WIDGET,
            name="Text:",
        )
        t3 = F.add(
            self.__class__.__TEXT_WIDGET,
            name="Text:",
        )
        t4 = F.add(
            self.__class__.__TEXT_WIDGET,
            name="Text:",
        )

        m1 = F.add(npyscreen.MultiLine,
                   name="Mutliline",
                   scroll_exit=True,
                   max_height=5)

        me = F.add(npyscreen.MultiLineEdit, name="Testing", autowrap=False)

        t1.value = u"This is a \n test"
        t2.value = u"This is a é test"
        t3.value = u"This is ∑ a test"
        t1.value = u"Testing tripple width \u3111 stuff."
        t2.value = u"Testing double width stuff \u1000 <- there"
        t4.value = u"another test is \u1D656 this one."

        m1.values = [
            t1.value, t2.value, t3.value, 'another test \u24AF is here',
            'another test is \u1D666 this one.'
        ]

        me.value = '\n'.join([
            t1.value, t2.value, t3.value, 'another test is \u1D656 this one.'
        ])

        # This lets the user play with the Form.
        F.edit()
    def main(self):
        # These lines create the form and populate it with widgets.
        # A fairly complex screen in only 8 or so lines of code - a line for each control.
        F = npyscreen.ActionFormWithMenus(name="Welcome to Npyscreen", )
        f = F.add(npyscreen.TitleFixedText,
                  name="Fixed Text:",
                  value="This is fixed text")
        #t10= F.add(npyscreen.TitleText,  use_two_lines=None, name = "10:" ,max_width = 10)
        #t15 = F.add(npyscreen.TitleText, use_two_lines=None, name = "15:" ,max_width = 15)
        t20 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="20:",
                    max_width=20)
        t25 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="25:",
                    max_width=25)
        t30 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="30:",
                    max_width=30)
        t35 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="35:",
                    max_width=35)
        t40 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="40:",
                    max_width=40)
        t45 = F.add(npyscreen.TitleText,
                    use_two_lines=None,
                    name="45:",
                    max_width=45)

        tmax = F.add(npyscreen.TitleText,
                     use_two_lines=None,
                     name="Max",
                     max_width=False)
        tn20 = F.add(npyscreen.TitleText,
                     use_two_lines=None,
                     name="n20:",
                     max_width=-20)
        #tn200= F.add(npyscreen.TitleText,  use_two_lines=None, name = "n200:" ,max_width = -200)

        F.edit()
Beispiel #5
0
    def main(self):
        # These lines create the form and populate it with widgets.
        # A fairly complex screen in only 8 or so lines of code - a line for each control.
        npyscreen.setTheme(npyscreen.Themes.ColorfulTheme)
        F = npyscreen.ActionFormWithMenus(name = "Welcome to Npyscreen",)
        self.t = F.add(npyscreen.TitleText, name = "Run Number:",  value=str(int(self.run_number_pv.get())))
        self.rc = F.add(npyscreen.TitleText, name = "Run Charge:",  value=str(float(self.run_charge_pv.get())))
        fn = F.add(npyscreen.TitleFilename, name = "Filename:")
        dt = F.add(npyscreen.TitleDateCombo, name = "Date:", value=datetime.datetime.now(), use_datetime=True)
        s = F.add(npyscreen.TitleSlider, out_of=12, name = "Slider")

        ml_value= str(datetime.datetime.now())+ "\n";

        ml= F.add(npyscreen.MultiLineEdit, 
            value = ml_value, 
            max_height=5, rely=9)
        ms= F.add(npyscreen.TitleSelectOne, max_height=4, value = [1,], name="Pick One", 
                values = ["Option1","Option2","Option3"], scroll_exit=True)
        ms2= F.add(npyscreen.TitleMultiSelect, max_height=4, value = [1,], name="Pick Several", 
                values = ["Option1","Option2","Option3"], scroll_exit=True)
        
        # This lets the user play with the Form.
        F.edit()