Example #1
0
 def set_graze_coef():
     """Requests new graze coefficient from the user."""
     v = simpledialog.askinteger(
         "Settings", "Graze coefficient:",
         initialvalue=lnp.settings.grazeCoef)
     if v is not None:
         df.set_option('grazeCoef', str(v))
         binding.update()
Example #2
0
 def set_strict_pop_cap():
     """Requests new strict population cap from the user."""
     v = simpledialog.askinteger(
         "Settings", "Strict population cap:",
         initialvalue=lnp.settings.strictPopcap)
     if v is not None:
         df.set_option('strictPopcap', str(v))
         binding.update()
Example #3
0
 def set_inv_monster_cap():
     """Requests new invasion monster cap from the user."""
     v = simpledialog.askinteger("Settings",
                                 "Cap on # of monsters in invasion:",
                                 initialvalue=lnp.settings.invMonsterCap)
     if v is not None:
         df.set_option('invMonsterCap', str(v))
         binding.update()
Example #4
0
 def set_visitor_cap():
     """Requests new visitor cap from the user."""
     v = simpledialog.askinteger("Settings",
                                 "Visitor cap:",
                                 initialvalue=lnp.settings.visitorCap)
     if v is not None:
         df.set_option('visitorCap', str(v))
         binding.update()
Example #5
0
 def set_graze_coef():
     """Requests new graze coefficient from the user."""
     v = simpledialog.askinteger("Settings",
                                 "Graze coefficient:",
                                 initialvalue=lnp.settings.grazeCoef)
     if v is not None:
         df.set_option('grazeCoef', str(v))
         binding.update()
Example #6
0
 def set_strict_pop_cap():
     """Requests new strict population cap from the user."""
     v = simpledialog.askinteger("Settings",
                                 "Strict population cap:",
                                 initialvalue=lnp.settings.strictPopcap)
     if v is not None:
         df.set_option('strictPopcap', str(v))
         binding.update()
Example #7
0
    def set_option(field):
        """
        Sets an option directly.

        Args:
            field: The field name to change. The corresponding value is
                automatically read.
        """
        if not isinstance(field, basestring):
            for f in field:
                df.set_option(f, binding.get(field))
        else:
            df.set_option(field, binding.get(field))
        binding.update()
Example #8
0
    def change_entry(key, var):
        """
        Commits a change for the control specified by key.

        Args:
            key: The key for the control that changed.
            var: The variable bound to the control.
        """
        if not isinstance(key, basestring):
            for k in key:
                TkGui.change_entry(k, var)
            return
        if var.get() != '':
            df.set_option(key, var.get())
Example #9
0
 def set_child_cap():
     """Requests new child cap from the user."""
     child_split = list(lnp.settings.childcap.split(':'))
     child_split.append('0')  # In case syntax is invalid
     v = simpledialog.askinteger(
         "Settings", "Absolute cap on babies + children:",
         initialvalue=child_split[0])
     if v is not None:
         v2 = simpledialog.askinteger(
             "Settings", "Max percentage of children in fort:\n"
             "(lowest of the two values will be used as the cap)",
             initialvalue=child_split[1])
         if v2 is not None:
             df.set_option('childcap', str(v)+':'+str(v2))
             binding.update()
Example #10
0
    def set_option(field):
        """
        Sets an option directly.

        Params:
            field
                The field name to change. The corresponding value is
                automatically read.
        """
        if not isinstance(field, basestring):
            for f in field:
                df.set_option(f, binding.get(field))
        else:
            df.set_option(field, binding.get(field))
        binding.update()
Example #11
0
 def set_child_cap():
     """Requests new child cap from the user."""
     child_split = list(lnp.settings.childcap.split(':'))
     child_split.append('0')  # In case syntax is invalid
     v = simpledialog.askinteger("Settings",
                                 "Absolute cap on babies + children:",
                                 initialvalue=child_split[0])
     if v is not None:
         v2 = simpledialog.askinteger(
             "Settings", "Max percentage of children in fort:\n"
             "(lowest of the two values will be used as the cap)",
             initialvalue=child_split[1])
         if v2 is not None:
             df.set_option('childcap', str(v) + ':' + str(v2))
             binding.update()
Example #12
0
    def change_entry(key, var):
        """
        Commits a change for the control specified by key.

        Params:
            key
                The key for the control that changed.
            var
                The variable bound to the control.
        """
        if not isinstance(key, basestring):
            for k in key:
                TkGui.change_entry(k, var)
            return
        if var.get() != '':
            df.set_option(key, var.get())