Exemplo n.º 1
0
	def __init__(self, parent, win_id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
			style=wx.LC_ICON, validator=wx.DefaultValidator, name=wx.ListCtrlNameStr,
			defaultValue=None, required=False, outLabel=None):

		BorderedPanel.__init__(self, parent, win_id, pos, size, name=name)

		if isinstance(self, EssentialField):
			self.MainCtrl = ListCtrlBaseESS(self, style=style, validator=validator,
					defaultValue=defaultValue, required=required, outLabel=outLabel)

		else:
			self.MainCtrl = ListCtrlBase(self, style=style, validator=validator,
					defaultValue=defaultValue, required=required, outLabel=outLabel)

		# Match panel background color to list control
		self.SetBackgroundColour(self.MainCtrl.GetBackgroundColour())

		self.layout_V1 = BoxSizer(wx.VERTICAL)
		self.layout_V1.Add(self.MainCtrl, 1, wx.EXPAND)

		self.SetAutoLayout(True)
		self.SetSizer(self.layout_V1)
		self.Layout()

		if wx.MAJOR_VERSION == 3 and wx.MINOR_VERSION == 0:
			wx.EVT_SIZE(self, self.OnResize)
Exemplo n.º 2
0
	def __init__(self, parent, win_id=wx.ID_ANY, value=wx.EmptyString, defaultValue=wx.EmptyString,
			monospace=False, button=MT_NO_BTN, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0,
			name=wx.TextCtrlNameStr, required=False, outLabel=None):

		BorderedPanel.__init__(self, parent, win_id, pos, size, name=name)

		self.MainCtrl = TextAreaML(self, value=value, defaultValue=defaultValue,
				style=style|wx.BORDER_NONE, required=required, outLabel=outLabel)

		# For setting color of disabled panel
		self.clr_disabled = self.GetBackgroundColour()
		self.clr_enabled = self.MainCtrl.GetBackgroundColour()

		# Match panel color to text control
		self.SetBackgroundColour(self.MainCtrl.GetBackgroundColour())

		# *** Layout *** #

		lyt_main = BoxSizer(wx.HORIZONTAL)
		lyt_main.Add(self.MainCtrl, 1, wx.EXPAND|wx.ALL, 2)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		# *** Post-layout Actions *** #

		if monospace:
			self.SetMonospaced(button)
Exemplo n.º 3
0
 def __init__(self, parent, ID=wx.ID_ANY, items=[], pos=wx.DefaultPosition, size=wx.DefaultSize,
         style=wx.VSCROLL, name=wx.PanelNameStr):
     
     BorderedPanel.__init__(self, parent, ID, pos, size, name=name)
     
     self.SetBackgroundColour(u'white')
     
     pnl_bg = ScrolledPanel(self, pnlid.BACKGROUND, style=style|wx.TAB_TRAVERSAL|wx.BORDER_NONE)
     pnl_bg.SetBackgroundColour(self.GetBackgroundColour())
     pnl_bg.SetScrollbars(20, 20, 50, 50)
     
     # *** Event Handling *** #
     
     self.Bind(wx.EVT_CHECKBOX, self.OnCheckItem)
     
     # *** Layout *** #
     
     lyt_bg = BoxSizer(wx.VERTICAL)
     
     pnl_bg.SetSizer(lyt_bg)
     pnl_bg.SetAutoLayout(True)
     
     lyt_main = BoxSizer(wx.VERTICAL)
     lyt_main.Add(pnl_bg, 1, wx.EXPAND)
     
     self.SetSizer(lyt_main)
     self.SetAutoLayout(True)
     self.Layout()
     
     # *** Post-Layout Actions *** #
     
     if items:
         self.AddItems(items)
Exemplo n.º 4
0
	def __init__(self, parent, ID=wx.ID_ANY, items=[], pos=wx.DefaultPosition, size=wx.DefaultSize,
			style=wx.VSCROLL, name=wx.PanelNameStr):

		BorderedPanel.__init__(self, parent, ID, pos, size, name=name)

		self.SetBackgroundColour(u'white')

		pnl_bg = ScrolledPanel(self, pnlid.BACKGROUND, style=style|wx.TAB_TRAVERSAL|wx.BORDER_NONE)
		pnl_bg.SetBackgroundColour(self.GetBackgroundColour())
		pnl_bg.SetScrollbars(20, 20, 50, 50)

		# *** Event Handling *** #

		self.Bind(wx.EVT_CHECKBOX, self.OnCheckItem)

		# *** Layout *** #

		lyt_bg = BoxSizer(wx.VERTICAL)

		pnl_bg.SetSizer(lyt_bg)
		pnl_bg.SetAutoLayout(True)

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.Add(pnl_bg, 1, wx.EXPAND)

		self.SetSizer(lyt_main)
		self.SetAutoLayout(True)
		self.Layout()

		# *** Post-Layout Actions *** #

		if items:
			self.AddItems(items)
Exemplo n.º 5
0
	def __init__(self, parent, win_id=wx.ID_ANY, value=wx.EmptyString, defaultValue=wx.EmptyString,
			monospace=False, button=MT_NO_BTN, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0,
			name=wx.TextCtrlNameStr, required=False, outLabel=None):

		BorderedPanel.__init__(self, parent, win_id, pos, size, name=name)

		self.MainCtrl = TextAreaML(self, value=value, defaultValue=defaultValue,
				style=style|wx.BORDER_NONE, required=required, outLabel=outLabel)

		# For setting color of disabled panel
		self.clr_disabled = self.GetBackgroundColour()
		self.clr_enabled = self.MainCtrl.GetBackgroundColour()

		# Match panel color to text control
		self.SetBackgroundColour(self.MainCtrl.GetBackgroundColour())

		# *** Layout *** #

		lyt_main = BoxSizer(wx.HORIZONTAL)
		lyt_main.Add(self.MainCtrl, 1, wx.EXPAND|wx.ALL, 2)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		# *** Post-layout Actions *** #

		if monospace:
			self.SetMonospaced(button)
Exemplo n.º 6
0
    def __init__(self,
                 parent,
                 defaultPath,
                 win_id=-1,
                 defaultType=CheckBox,
                 defaultValue=True,
                 customType=PathCtrl,
                 name=u'file_output_target',
                 pathIds=[]):

        BorderedPanel.__init__(self, parent, win_id, name=name)

        id_default = wx.ID_ANY
        id_custom = wx.ID_ANY

        if pathIds:
            if isinstance(pathIds, int):
                id_default = pathIds

            else:
                id_default = pathIds[0]

                if len(pathIds) > 1:
                    id_custom = pathIds[1]

        self.PathDefault = defaultType(self,
                                       id_default,
                                       defaultPath,
                                       defaultValue=defaultValue)

        self.PathCustom = customType(self, id_custom)

        # *** Event Handing *** #

        self.PathDefault.Bind(wx.EVT_CHECKBOX, self.OnSelectTarget)

        # *** Layout *** #

        lyt_main = BoxSizer(wx.VERTICAL)

        lyt_main.AddSpacer(5)
        lyt_main.Add(self.PathDefault, 0, lyt.PAD_LR, 5)
        lyt_main.AddSpacer(5)
        lyt_main.Add(self.PathCustom, 0, wx.EXPAND | lyt.PAD_LR, 5)
        lyt_main.AddSpacer(5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()

        # *** Post Layout/Event Actions *** #

        self.PathDefault.SetChecked(self.PathDefault.GetDefaultValue())
Exemplo n.º 7
0
	def __init__(self, parent, winId=wx.ID_ANY, name=u'menubar'):
		BorderedPanel.__init__(self, parent, winId, name=name)

		self.Padding = 5

		# *** Event Handling *** #

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

		# *** Layout *** #

		lyt_main = BoxSizer(wx.HORIZONTAL)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
Exemplo n.º 8
0
    def __init__(self, parent, winId=wx.ID_ANY, name=u'menubar'):
        BorderedPanel.__init__(self, parent, winId, name=name)

        self.Padding = 5

        # *** Event Handling *** #

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

        # *** Layout *** #

        lyt_main = BoxSizer(wx.HORIZONTAL)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
Exemplo n.º 9
0
    def Enable(self, *args, **kwargs):
        # Clearing text area is done as workaround for text background color bug
        current_value = self.MainCtrl.GetValue()
        insertion_point = self.MainCtrl.GetInsertionPoint()
        self.MainCtrl.Clear()

        return_value = BorderedPanel.Enable(self, *args, **kwargs)

        if self.IsEnabled():
            self.SetBackgroundColour(self.clr_enabled)

            # Older versions of wx do not change color of disabled multiline text control
            if wx.MAJOR_VERSION < 3:
                self.MainCtrl.SetBackgroundColour(self.clr_enabled)

        else:
            self.SetBackgroundColour(self.clr_disabled)

            # Older versions of wx do not change color of disabled multiline text control
            if wx.MAJOR_VERSION < 3:
                self.MainCtrl.SetBackgroundColour(self.clr_disabled)

        # Reinstate the text
        self.MainCtrl.SetValue(current_value)
        self.MainCtrl.SetInsertionPoint(insertion_point)

        return return_value
Exemplo n.º 10
0
 def __init__(self, parent, w_id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
         style=wx.TAB_TRAVERSAL, name=u'DirTreePnl'):
     BorderedPanel.__init__(self, parent, w_id, pos, size, style, name)
     
     self.DirTree = DirectoryTree(self)
     
     # Give easy access of instance to parent
     parent.DirTree = self.DirTree
     
     # *** Layout *** #
     
     lyt_main = BoxSizer(wx.VERTICAL)
     lyt_main.Add(self.DirTree, 1, wx.EXPAND)
     
     self.SetAutoLayout(True)
     self.SetSizer(lyt_main)
     self.Layout()
Exemplo n.º 11
0
	def __init__(self, parent, w_id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize,
			style=wx.TAB_TRAVERSAL, name=u'DirTreePnl'):
		BorderedPanel.__init__(self, parent, w_id, pos, size, style, name)

		self.DirTree = DirectoryTree(self)

		# Give easy access of instance to parent
		parent.DirTree = self.DirTree

		# *** Layout *** #

		lyt_main = BoxSizer(wx.VERTICAL)
		lyt_main.Add(self.DirTree, 1, wx.EXPAND)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Exemplo n.º 12
0
	def __init__(self, parent, defaultPath, win_id=-1, defaultType=CheckBox, defaultValue=True,
			customType=PathCtrl, name=u'file_output_target', pathIds=[]):

		BorderedPanel.__init__(self, parent, win_id, name=name)

		id_default = wx.ID_ANY
		id_custom = wx.ID_ANY

		if pathIds:
			if isinstance(pathIds, int):
				id_default = pathIds

			else:
				id_default = pathIds[0]

				if len(pathIds) > 1:
					id_custom = pathIds[1]

		self.PathDefault = defaultType(self, id_default, defaultPath, defaultValue=defaultValue)

		self.PathCustom = customType(self, id_custom)

		# *** Event Handing *** #

		self.PathDefault.Bind(wx.EVT_CHECKBOX, self.OnSelectTarget)

		# *** Layout *** #

		lyt_main = BoxSizer(wx.VERTICAL)

		lyt_main.AddSpacer(5)
		lyt_main.Add(self.PathDefault, 0, lyt.PAD_LR, 5)
		lyt_main.AddSpacer(5)
		lyt_main.Add(self.PathCustom, 0, wx.EXPAND|lyt.PAD_LR, 5)
		lyt_main.AddSpacer(5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		# *** Post Layout/Event Actions *** #

		self.PathDefault.SetChecked(self.PathDefault.GetDefaultValue())
Exemplo n.º 13
0
    def __init__(self,
                 parent,
                 win_id=wx.ID_ANY,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.LC_ICON,
                 validator=wx.DefaultValidator,
                 name=wx.ListCtrlNameStr,
                 defaultValue=None,
                 required=False,
                 outLabel=None):

        BorderedPanel.__init__(self, parent, win_id, pos, size, name=name)

        if isinstance(self, EssentialField):
            self.MainCtrl = ListCtrlBaseESS(self,
                                            style=style,
                                            validator=validator,
                                            defaultValue=defaultValue,
                                            required=required,
                                            outLabel=outLabel)

        else:
            self.MainCtrl = ListCtrlBase(self,
                                         style=style,
                                         validator=validator,
                                         defaultValue=defaultValue,
                                         required=required,
                                         outLabel=outLabel)

        # Match panel background color to list control
        self.SetBackgroundColour(self.MainCtrl.GetBackgroundColour())

        self.layout_V1 = BoxSizer(wx.VERTICAL)
        self.layout_V1.Add(self.MainCtrl, 1, wx.EXPAND)

        self.SetAutoLayout(True)
        self.SetSizer(self.layout_V1)
        self.Layout()

        if wx.MAJOR_VERSION == 3 and wx.MINOR_VERSION == 0:
            wx.EVT_SIZE(self, self.OnResize)
Exemplo n.º 14
0
    def __init__(self, parent, win_id=wx.ID_ANY):
        BorderedPanel.__init__(self, parent, win_id)

        txt_key = wx.StaticText(self, label=GT(u'Key'))
        txt_value = wx.StaticText(self, label=GT(u'Value'))

        ti_key = TextAreaESS(self, inputid.KEY)
        ti_value = TextAreaESS(self, inputid.VALUE)

        # *** Layout *** #

        lyt_input = wx.FlexGridSizer()
        lyt_input.SetRows(2)
        lyt_input.SetCols(2)
        lyt_input.AddGrowableCol(1)

        lyt_input.Add(txt_key, 0, wx.LEFT | wx.TOP, 5)
        lyt_input.Add(txt_value, 0, wx.LEFT | wx.TOP, 5)
        lyt_input.Add(ti_key, 0, wx.LEFT | wx.BOTTOM, 5)
        lyt_input.Add(ti_value, 1, wx.EXPAND | wx.LEFT | wx.BOTTOM, 5)
Exemplo n.º 15
0
	def __init__(self, parent, win_id=wx.ID_ANY):
		BorderedPanel.__init__(self, parent, win_id)

		txt_key = wx.StaticText(self, label=GT(u'Key'))
		txt_value = wx.StaticText(self, label=GT(u'Value'))

		ti_key = TextAreaESS(self, inputid.KEY)
		ti_value = TextAreaESS(self, inputid.VALUE)

		# *** Layout *** #

		lyt_input = wx.FlexGridSizer()
		lyt_input.SetRows(2)
		lyt_input.SetCols(2)
		lyt_input.AddGrowableCol(1)

		lyt_input.Add(txt_key, 0, wx.LEFT|wx.TOP, 5)
		lyt_input.Add(txt_value, 0, wx.LEFT|wx.TOP, 5)
		lyt_input.Add(ti_key, 0, wx.LEFT|wx.BOTTOM, 5)
		lyt_input.Add(ti_value, 1, wx.EXPAND|wx.LEFT|wx.BOTTOM, 5)
Exemplo n.º 16
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.FILES)

		# *** Left Panel *** #

		pnl_treeopts = BorderedPanel(self)

		self.chk_individuals = CheckBoxCFG(pnl_treeopts, label=GT(u'List files individually'),
				name=u'individually', cfgSect=u'FILES')

		self.chk_preserve_top = CheckBoxCFG(pnl_treeopts, chkid.TOPLEVEL, GT(u'Preserve top-level directories'),
				name=u'top-level', cfgSect=u'FILES')

		self.chk_nofollow_symlink = CheckBoxCFG(pnl_treeopts, chkid.SYMLINK, GT(u'Don\'t follow symbolic links'),
				defaultValue=True, name=u'nofollow-symlink', cfgSect=u'FILES')

		self.tree_dirs = DirectoryTreePanel(self, size=(300,20))

		# ----- Target path
		pnl_target = BorderedPanel(self)

		# choices of destination
		rb_bin = wx.RadioButton(pnl_target, label=u'/bin', style=wx.RB_GROUP)
		rb_usrbin = wx.RadioButton(pnl_target, label=u'/usr/bin')
		rb_usrlib = wx.RadioButton(pnl_target, label=u'/usr/lib')
		rb_locbin = wx.RadioButton(pnl_target, label=u'/usr/local/bin')
		rb_loclib = wx.RadioButton(pnl_target, label=u'/usr/local/lib')
		self.rb_custom = wx.RadioButton(pnl_target, inputid.CUSTOM, GT(u'Custom'))
		self.rb_custom.Default = True

		# Start with "Custom" selected
		self.rb_custom.SetValue(self.rb_custom.Default)

		# group buttons together
		# FIXME: Unnecessary???
		self.grp_targets = (
			rb_bin,
			rb_usrbin,
			rb_usrlib,
			rb_locbin,
			rb_loclib,
			self.rb_custom,
			)

		# ----- Add/Remove/Clear buttons
		btn_add = CreateButton(self, btnid.ADD)
		btn_remove = CreateButton(self, btnid.REMOVE)
		btn_clear = CreateButton(self, btnid.CLEAR)

		self.prev_dest_value = u'/usr/bin'
		self.ti_target = TextArea(self, defaultValue=self.prev_dest_value, name=u'target')

		self.btn_browse = CreateButton(self, btnid.BROWSE)
		btn_refresh = CreateButton(self, btnid.REFRESH)

		# Display area for files added to list
		self.lst_files = FileListESS(self, inputid.LIST, name=u'filelist')

		# *** Event Handling *** #

		# create an event to enable/disable custom widget
		for item in self.grp_targets:
			wx.EVT_RADIOBUTTON(item, wx.ID_ANY, self.OnSetDestination)

		# Context menu events for directory tree
		wx.EVT_MENU(self, wx.ID_ADD, self.OnImportFromTree)

		# Button events
		btn_add.Bind(wx.EVT_BUTTON, self.OnImportFromTree)
		btn_remove.Bind(wx.EVT_BUTTON, self.OnRemoveSelected)
		btn_clear.Bind(wx.EVT_BUTTON, self.OnClearFileList)
		self.btn_browse.Bind(wx.EVT_BUTTON, self.OnBrowse)
		btn_refresh.Bind(wx.EVT_BUTTON, self.OnRefreshFileList)

		# ???: Not sure what these do
		wx.EVT_KEY_DOWN(self.ti_target, self.GetDestValue)
		wx.EVT_KEY_UP(self.ti_target, self.CheckDest)

		# Key events for file list
		wx.EVT_KEY_DOWN(self.lst_files, self.OnRemoveSelected)

		self.Bind(wx.EVT_DROP_FILES, self.OnDropFiles)

		# *** Layout *** #

		lyt_treeopts = BoxSizer(wx.VERTICAL)
		lyt_treeopts.AddSpacer(5)
		lyt_treeopts.Add(self.chk_individuals, 0, lyt.PAD_LR, 5)
		lyt_treeopts.Add(self.chk_preserve_top, 0, lyt.PAD_LR, 5)
		lyt_treeopts.Add(self.chk_nofollow_symlink, 0, lyt.PAD_LR, 5)
		lyt_treeopts.AddSpacer(5)

		pnl_treeopts.SetSizer(lyt_treeopts)

		lyt_left = BoxSizer(wx.VERTICAL)
		lyt_left.AddSpacer(10)
		lyt_left.Add(wx.StaticText(self, label=GT(u'Directory options')), 0, wx.ALIGN_BOTTOM)
		lyt_left.Add(pnl_treeopts, 0, wx.EXPAND|wx.ALIGN_LEFT|wx.BOTTOM, 5)
		lyt_left.Add(self.tree_dirs, 1, wx.EXPAND)

		lyt_target = wx.GridSizer(3, 2, 5, 5)

		for item in self.grp_targets:
			lyt_target.Add(item, 0, lyt.PAD_LR, 5)

		pnl_target.SetAutoLayout(True)
		pnl_target.SetSizer(lyt_target)
		pnl_target.Layout()

		# Put text input in its own sizer to force expand
		lyt_input = BoxSizer(wx.HORIZONTAL)
		lyt_input.Add(self.ti_target, 1, wx.ALIGN_CENTER_VERTICAL)

		lyt_buttons = BoxSizer(wx.HORIZONTAL)
		lyt_buttons.Add(btn_add, 0)
		lyt_buttons.Add(btn_remove, 0)
		lyt_buttons.Add(btn_clear, 0)
		lyt_buttons.Add(lyt_input, 1, wx.ALIGN_CENTER_VERTICAL)
		lyt_buttons.Add(self.btn_browse, 0)
		lyt_buttons.Add(btn_refresh, 0)

		lyt_right = BoxSizer(wx.VERTICAL)
		lyt_right.AddSpacer(10)
		lyt_right.Add(wx.StaticText(self, label=GT(u'Target')))
		lyt_right.Add(pnl_target, 0, wx.TOP, 5)
		lyt_right.Add(lyt_buttons, 0, wx.EXPAND)
		lyt_right.Add(self.lst_files, 5, wx.EXPAND|wx.TOP, 5)

		PROP_LEFT = 0
		PROP_RIGHT = 1

		lyt_main = wx.FlexGridSizer(1, 2)
		lyt_main.AddGrowableRow(0)

		# Directory tree size issues with wx 2.8
		if wx.MAJOR_VERSION <= 2:
			PROP_LEFT = 1
			lyt_main.AddGrowableCol(0, 1)

		lyt_main.AddGrowableCol(1, 2)
		lyt_main.Add(lyt_left, PROP_LEFT, wx.EXPAND|lyt.PAD_LR|wx.BOTTOM, 5)
		lyt_main.Add(lyt_right, PROP_RIGHT, wx.EXPAND|lyt.PAD_RB, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()

		SetPageToolTips(self)
Exemplo n.º 17
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.BUILD)

        # Bypass build prep check
        self.prebuild_check = False

        # Add checkable items to this list
        # FIXME: Use a different method
        self.build_options = []

        # ----- Extra Options

        pnl_options = BorderedPanel(self)

        self.chk_md5 = CheckBoxESS(pnl_options,
                                   chkid.MD5,
                                   GT(u'Create md5sums file'),
                                   name=u'MD5',
                                   defaultValue=True,
                                   commands=u'md5sum')
        # The » character denotes that an alternate tooltip should be shown if the control is disabled
        self.chk_md5.tt_name = u'md5»'
        self.chk_md5.col = 0

        if UsingTest(u'alpha'):
            # Brings up control file preview for editing
            self.chk_editctrl = CheckBoxCFG(
                pnl_options,
                chkid.EDIT,
                GT(u'Preview control file for editing'),
                name=u'editctrl')
            self.chk_editctrl.col = 1

        # TODO: Use CheckBoxCFG instead of CheckBoxESS:
        #		   Fields will be set from config instead of project file

        # Option to strip binaries
        self.chk_strip = CheckBoxESS(pnl_options,
                                     chkid.STRIP,
                                     GT(u'Strip binaries'),
                                     name=u'strip»',
                                     defaultValue=True,
                                     commands=u'strip')
        self.chk_strip.col = 0

        # Deletes the temporary build tree
        self.chk_rmstage = CheckBoxESS(pnl_options,
                                       chkid.DELETE,
                                       GT(u'Delete staged directory'),
                                       name=u'RMSTAGE',
                                       defaultValue=True)
        self.chk_rmstage.col = 0

        # Checks the output .deb for errors
        self.chk_lint = CheckBoxESS(
            pnl_options,
            chkid.LINT,
            GT(u'Check package for errors with lintian'),
            name=u'LINTIAN',
            defaultValue=True,
            commands=u'lintian')
        self.chk_lint.tt_name = u'lintian»'
        self.chk_lint.col = 0

        # Installs the deb on the system
        self.chk_install = CheckBox(pnl_options,
                                    chkid.INSTALL,
                                    GT(u'Install package after build'),
                                    name=u'INSTALL',
                                    commands=(
                                        u'gdebi-gtk',
                                        u'gdebi-kde',
                                    ))
        self.chk_install.tt_name = u'install»'
        self.chk_install.col = 0

        # *** Lintian Overrides *** #

        if UsingTest(u'alpha'):
            # FIXME: Move next to lintian check box
            self.lint_overrides = []
            btn_lint_overrides = CreateButton(self,
                                              label=GT(u'Lintian overrides'))
            btn_lint_overrides.Bind(wx.EVT_BUTTON, self.OnSetLintOverrides)

        btn_build = CreateButton(self, btnid.BUILD, GT(u'Build'), u'build', 64)

        # Display log
        dsp_log = OutputLog(self)

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_build.Bind(wx.EVT_BUTTON, self.OnBuild)

        # *** Layout *** #

        lyt_options = wx.GridBagSizer()

        next_row = 0
        prev_row = next_row
        for CHK in pnl_options.Children:
            row = next_row
            FLAGS = lyt.PAD_LR

            if CHK.col:
                row = prev_row
                FLAGS = wx.RIGHT

            lyt_options.Add(CHK, (row, CHK.col), flag=FLAGS, border=5)

            if not CHK.col:
                prev_row = next_row
                next_row += 1

        pnl_options.SetSizer(lyt_options)
        pnl_options.SetAutoLayout(True)
        pnl_options.Layout()

        lyt_buttons = BoxSizer(wx.HORIZONTAL)
        lyt_buttons.Add(btn_build, 1)

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(10)
        lyt_main.Add(wx.StaticText(self, label=GT(u'Extra Options')), 0,
                     lyt.ALGN_LB | wx.LEFT, 5)
        lyt_main.Add(pnl_options, 0, wx.LEFT, 5)
        lyt_main.AddSpacer(5)

        if UsingTest(u'alpha'):
            #lyt_main.Add(wx.StaticText(self, label=GT(u'Lintian overrides')), 0, wx.LEFT, 5)
            lyt_main.Add(btn_lint_overrides, 0, wx.LEFT, 5)

        lyt_main.AddSpacer(5)
        lyt_main.Add(lyt_buttons, 0, lyt.ALGN_C)
        lyt_main.Add(dsp_log, 2, wx.EXPAND | lyt.PAD_LRB, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()

        # *** Post-layout functions *** #

        self.InitDefaultSettings()
Exemplo n.º 18
0
    def SetModeEasy(self):
        # Add sibling panel to hold menu & rename button
        pnl_top = wx.Panel(self)

        for C in self.GetChildren():
            if isinstance(C, wx.Button):
                C.Reparent(pnl_top)

        # FIXME: Hack
        temp_bar = BorderedPanel(pnl_top)

        menubar = PanelMenuBar(temp_bar)
        menubar.HideBorder()

        menu_add = PanelMenu(menubar, label=GT(u'Add'))
        menu_add.Append(manid.SINGLE, GT(u'Single line section'))
        menu_add.Append(manid.MULTILINE, GT(u'Multi-line section'))

        menubar.AddItem(menu_add)

        self.pnl_bottom = ScrolledPanel(self)

        # *** Banners *** #

        txt_banners = wx.StaticText(self.pnl_bottom, label=GT(u'Banners'))
        banners = ManBanner(self.pnl_bottom)
        pnl_banners = banners.GetPanel()

        # *** Event Handling *** #

        wx.EVT_MENU(self, manid.SINGLE, self.OnAddDocumentSection)
        wx.EVT_MENU(self, manid.MULTILINE, self.OnAddDocumentSection)

        # *** Layout *** #

        # FIXME: Hack
        temp_lyt = BoxSizer(wx.HORIZONTAL)
        temp_lyt.Add(menubar)
        temp_lyt.AddStretchSpacer(1)

        temp_bar.SetSizer(temp_lyt)

        lyt_top = BoxSizer(wx.VERTICAL)
        lyt_top.Add(self.lyt_buttons, 0, wx.EXPAND | wx.ALL, 5)
        # FIXME: temp_bar height is initially wrong
        lyt_top.Add(temp_bar, 0, wx.EXPAND | wx.ALL, 5)

        pnl_top.SetAutoLayout(True)
        pnl_top.SetSizer(lyt_top)

        # FIXME: Use GridBagSizer???
        lyt_bottom = BoxSizer(wx.VERTICAL)
        lyt_bottom.Add(txt_banners, 0, wx.ALIGN_BOTTOM | wx.LEFT | wx.TOP, 5)
        lyt_bottom.Add(pnl_banners, 0, wx.LEFT, 5)
        lyt_bottom.AddStretchSpacer(1)

        self.pnl_bottom.SetAutoLayout(True)
        self.pnl_bottom.SetSizer(lyt_bottom)

        self.lyt_main.Add(pnl_top, 0, wx.EXPAND)
        self.lyt_main.Add(self.pnl_bottom, 1, wx.EXPAND)

        self.SetAutoLayout(True)
        self.SetSizer(self.lyt_main)

        # *** Default Sections *** #

        # This calls self.Layout
        self.AddDocumentSection(GT(u'Name'))
        self.AddDocumentSection(GT(u'Synopsis'),
                                style=DEFAULT_MANSECT_STYLE | manid.MULTILINE)
        self.AddDocumentSection(GT(u'Description'),
                                style=DEFAULT_MANSECT_STYLE | manid.MULTILINE)
        self.AddDocumentSection(GT(u'Options'),
                                style=DEFAULT_MANSECT_STYLE | manid.MULTILINE)
        self.AddDocumentSection(GT(u'Examples'),
                                style=DEFAULT_MANSECT_STYLE | manid.MULTILINE)
        self.AddDocumentSection(GT(u'See also'))
Exemplo n.º 19
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.CONTROL)

        # Bypass checking this page for build
        # This is mandatory & done manually
        self.prebuild_check = False

        self.SetScrollbars(0, 20, 0, 0)

        pnl_bg = wx.Panel(self)

        # Buttons to open, save, & preview control file
        btn_open = CreateButton(pnl_bg,
                                btnid.BROWSE,
                                GT(u'Browse'),
                                u'browse',
                                name=u'btn browse')
        btn_save = CreateButton(pnl_bg,
                                btnid.SAVE,
                                GT(u'Save'),
                                u'save',
                                name=u'btn save')
        btn_preview = CreateButton(pnl_bg,
                                   btnid.PREVIEW,
                                   GT(u'Preview'),
                                   u'preview',
                                   name=u'btn preview')

        # *** Required fields *** #

        pnl_require = BorderedPanel(pnl_bg)

        txt_package = wx.StaticText(pnl_require,
                                    label=GT(u'Package'),
                                    name=u'package')
        txt_package.req = True
        ti_package = TextAreaESS(pnl_require,
                                 inputid.PACKAGE,
                                 name=txt_package.Name)
        ti_package.req = True

        txt_version = wx.StaticText(pnl_require,
                                    label=GT(u'Version'),
                                    name=u'version')
        txt_version.req = True
        ti_version = TextAreaESS(pnl_require,
                                 inputid.VERSION,
                                 name=txt_version.Name)
        ti_version.req = True

        txt_maintainer = wx.StaticText(pnl_require,
                                       label=GT(u'Maintainer'),
                                       name=u'maintainer')
        txt_maintainer.req = True
        ti_maintainer = TextAreaESS(pnl_require,
                                    inputid.MAINTAINER,
                                    name=txt_maintainer.Name)
        ti_maintainer.req = True

        txt_email = wx.StaticText(pnl_require,
                                  label=GT(u'Email'),
                                  name=u'email')
        txt_email.req = True
        ti_email = TextAreaESS(pnl_require, inputid.EMAIL, name=txt_email.Name)
        ti_email.req = True

        opts_arch = (
            u'all',
            u'alpha',
            u'amd64',
            u'arm',
            u'arm64',
            u'armeb',
            u'armel',
            u'armhf',
            u'avr32',
            u'hppa',
            u'i386',
            u'ia64',
            u'lpia',
            u'm32r',
            u'm68k',
            u'mips',
            u'mipsel',
            u'powerpc',
            u'powerpcspe',
            u'ppc64',
            u's390',
            u's390x',
            u'sh3',
            u'sh3eb',
            u'sh4',
            u'sh4eb',
            u'sparc',
            u'sparc64',
        )

        txt_arch = wx.StaticText(pnl_require,
                                 label=GT(u'Architecture'),
                                 name=u'architecture')
        sel_arch = ChoiceESS(pnl_require,
                             inputid.ARCH,
                             choices=opts_arch,
                             name=txt_arch.Name)
        sel_arch.Default = 0
        sel_arch.SetSelection(sel_arch.Default)

        # *** Recommended fields *** #

        pnl_recommend = BorderedPanel(pnl_bg)

        opts_section = (
            u'admin',
            u'cli-mono',
            u'comm',
            u'database',
            u'devel',
            u'debug',
            u'doc',
            u'editors',
            u'electronics',
            u'embedded',
            u'fonts',
            u'games',
            u'gnome',
            u'graphics',
            u'gnu-r',
            u'gnustep',
            u'hamradio',
            u'haskell',
            u'httpd',
            u'interpreters',
            u'java',
            u'kde',
            u'kernel',
            u'libs',
            u'libdevel',
            u'lisp',
            u'localization',
            u'mail',
            u'math',
            u'metapackages',
            u'misc',
            u'net',
            u'news',
            u'ocaml',
            u'oldlibs',
            u'otherosfs',
            u'perl',
            u'php',
            u'python',
            u'ruby',
            u'science',
            u'shells',
            u'sound',
            u'tex',
            u'text',
            u'utils',
            u'vcs',
            u'video',
            u'web',
            u'x11',
            u'xfce',
            u'zope',
        )

        txt_section = wx.StaticText(pnl_recommend,
                                    label=GT(u'Section'),
                                    name=u'section')
        ti_section = ComboBoxESS(pnl_recommend,
                                 choices=opts_section,
                                 name=txt_section.Name)

        opts_priority = (
            u'optional',
            u'standard',
            u'important',
            u'required',
            u'extra',
        )

        txt_priority = wx.StaticText(pnl_recommend,
                                     label=GT(u'Priority'),
                                     name=u'priority')
        sel_priority = ChoiceESS(pnl_recommend,
                                 choices=opts_priority,
                                 name=txt_priority.Name)
        sel_priority.Default = 0
        sel_priority.SetSelection(sel_priority.Default)

        txt_synopsis = wx.StaticText(pnl_recommend,
                                     label=GT(u'Short Description'),
                                     name=u'synopsis')
        ti_synopsis = TextAreaESS(pnl_recommend, name=txt_synopsis.Name)

        txt_description = wx.StaticText(pnl_recommend,
                                        label=GT(u'Long Description'),
                                        name=u'description')
        self.ti_description = TextAreaPanelESS(pnl_recommend,
                                               name=txt_description.Name)

        # *** Optional fields *** #

        pnl_option = BorderedPanel(pnl_bg)

        txt_source = wx.StaticText(pnl_option,
                                   label=GT(u'Source'),
                                   name=u'source')
        ti_source = TextAreaESS(pnl_option, name=txt_source.Name)

        txt_homepage = wx.StaticText(pnl_option,
                                     label=GT(u'Homepage'),
                                     name=u'homepage')
        ti_homepage = TextAreaESS(pnl_option, name=txt_homepage.Name)

        txt_essential = wx.StaticText(pnl_option,
                                      label=GT(u'Essential'),
                                      name=u'essential')
        self.chk_essential = CheckBoxESS(pnl_option, name=u'essential')
        self.chk_essential.Default = False

        self.grp_input = (
            ti_package,
            ti_version,
            ti_maintainer,  # Maintainer must be listed before email
            ti_email,
            ti_section,
            ti_source,
            ti_homepage,
            ti_synopsis,
            self.ti_description,
        )

        self.grp_select = (
            sel_arch,
            sel_priority,
        )

        SetPageToolTips(self)

        # *** Event Handling *** #

        btn_open.Bind(wx.EVT_BUTTON, self.OnBrowse)
        btn_save.Bind(wx.EVT_BUTTON, self.OnSave)
        btn_preview.Bind(wx.EVT_BUTTON, self.OnPreviewControl)

        # *** Layout *** #

        LEFT_BOTTOM = lyt.ALGN_LB
        RIGHT_CENTER = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT

        # Buttons
        lyt_buttons = BoxSizer(wx.HORIZONTAL)
        lyt_buttons.Add(btn_open, 0)
        lyt_buttons.Add(btn_save, 0)
        lyt_buttons.Add(btn_preview, 0)

        # Required fields
        lyt_require = wx.FlexGridSizer(0, 4, 5, 5)
        lyt_require.AddGrowableCol(1)
        lyt_require.AddGrowableCol(3)

        lyt_require.AddMany((
            (txt_package, 0, RIGHT_CENTER | lyt.PAD_LT, 5),
            (ti_package, 0, wx.EXPAND | wx.TOP, 5),
            (txt_version, 0, RIGHT_CENTER | wx.TOP, 5),
            (ti_version, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 5),
            (txt_maintainer, 0, RIGHT_CENTER | wx.LEFT, 5),
            (ti_maintainer, 0, wx.EXPAND),
            (txt_email, 0, RIGHT_CENTER, 5),
            (ti_email, 0, wx.EXPAND | wx.RIGHT, 5),
            (txt_arch, 0, RIGHT_CENTER | lyt.PAD_LB, 5),
            (sel_arch, 0, wx.BOTTOM, 5),
        ))

        pnl_require.SetSizer(lyt_require)
        pnl_require.SetAutoLayout(True)
        pnl_require.Layout()

        # Recommended fields
        lyt_recommend = wx.GridBagSizer()
        lyt_recommend.SetCols(4)
        lyt_recommend.AddGrowableCol(1)
        lyt_recommend.AddGrowableRow(3)

        lyt_recommend.Add(txt_section, (0, 2),
                          flag=RIGHT_CENTER | lyt.PAD_TB,
                          border=5)
        lyt_recommend.Add(ti_section, (0, 3),
                          flag=wx.EXPAND | lyt.PAD_RTB,
                          border=5)
        lyt_recommend.Add(txt_synopsis, (0, 0), (1, 2), LEFT_BOTTOM | wx.LEFT,
                          5)
        lyt_recommend.Add(ti_synopsis, (1, 0), (1, 2), wx.EXPAND | lyt.PAD_LR,
                          5)
        lyt_recommend.Add(txt_priority, (1, 2), flag=RIGHT_CENTER, border=5)
        lyt_recommend.Add(sel_priority, (1, 3),
                          flag=wx.EXPAND | wx.RIGHT,
                          border=5)
        lyt_recommend.Add(txt_description, (2, 0), (1, 2),
                          LEFT_BOTTOM | lyt.PAD_LT, 5)
        lyt_recommend.Add(self.ti_description, (3, 0), (1, 4),
                          wx.EXPAND | lyt.PAD_LR | wx.BOTTOM, 5)

        pnl_recommend.SetSizer(lyt_recommend)
        pnl_recommend.SetAutoLayout(True)
        pnl_recommend.Layout()

        # Optional fields
        lyt_option = wx.FlexGridSizer(0, 4, 5, 5)

        lyt_option.AddGrowableCol(1)
        lyt_option.AddGrowableCol(3)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddSpacer(5)
        lyt_option.AddMany((
            (txt_source, 0, RIGHT_CENTER | wx.LEFT, 5),
            (ti_source, 0, wx.EXPAND),
            (txt_homepage, 0, RIGHT_CENTER, 5),
            (ti_homepage, 0, wx.EXPAND | wx.RIGHT, 5),
            (txt_essential, 0, RIGHT_CENTER | lyt.PAD_LB, 5),
            (self.chk_essential, 0, wx.BOTTOM, 5),
        ))

        pnl_option.SetSizer(lyt_option)
        pnl_option.SetAutoLayout(True)
        pnl_option.Layout()

        # Main background panel sizer
        # FIXME: Is background panel (pnl_bg) necessary
        lyt_bg = BoxSizer(wx.VERTICAL)
        lyt_bg.Add(lyt_buttons, 0, wx.ALIGN_RIGHT | wx.BOTTOM, 5)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Required')), 0)
        lyt_bg.Add(pnl_require, 0, wx.EXPAND)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Recommended')), 0, wx.TOP,
                   5)
        lyt_bg.Add(pnl_recommend, 1, wx.EXPAND)
        lyt_bg.Add(wx.StaticText(pnl_bg, label=GT(u'Optional')), 0, wx.TOP, 5)
        lyt_bg.Add(pnl_option, 0, wx.EXPAND)

        pnl_bg.SetAutoLayout(True)
        pnl_bg.SetSizer(lyt_bg)
        pnl_bg.Layout()

        # Page's main sizer
        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.AddSpacer(5)
        lyt_main.Add(pnl_bg, 1, wx.EXPAND | lyt.PAD_LR | wx.BOTTOM, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Exemplo n.º 20
0
    def __init__(self, parent):
        ManSectBase.__init__(self, parent)

        self.Panel = BorderedPanel(parent)

        txt_section = wx.StaticText(self.Panel, label=GT(u'Section'))

        self.sel_section = Choice(self.Panel, choices=tuple(sections))
        self.sel_section.Default = u'1'
        self.sel_section.SetStringSelection(self.sel_section.Default)

        # Section description that changes with EVT_CHOICE
        self.LabelSection = wx.StaticText(self.Panel)
        self.SetSectionLabel()

        txt_date = wx.StaticText(self.Panel, label=GT(u'Date'))
        spin_year = wx.SpinCtrl(self.Panel,
                                min=1900,
                                max=2100,
                                initial=GetYear(string_value=False))
        spin_month = wx.SpinCtrl(self.Panel,
                                 min=1,
                                 max=12,
                                 initial=GetMonthInt())
        spin_day = wx.SpinCtrl(self.Panel, min=1, max=31, initial=GetDayInt())

        # FIXME: What is this for?
        txt_unknown1 = wx.StaticText(self.Panel, label=GT(u'Unknown'))
        ti_unknown1 = wx.TextCtrl(self.Panel)

        # FIXME: What is this for?
        txt_unknown2 = wx.StaticText(self.Panel, label=GT(u'Unknown'))
        ti_unknown2 = wx.TextCtrl(self.Panel)

        # *** Event Handling *** #

        self.sel_section.Bind(wx.EVT_CHOICE, self.OnSetSection)

        # *** Layout *** #

        lyt_section = BoxSizer(wx.HORIZONTAL)
        lyt_section.Add(txt_section, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER,
                        5)
        lyt_section.Add(self.sel_section, 0,
                        wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 5)
        lyt_section.Add(self.LabelSection, 0,
                        wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 5)

        lyt_date = wx.GridBagSizer()
        lyt_date.Add(txt_date, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Year')), (0, 1))
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Month')), (0, 2))
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Day')), (0, 3))
        lyt_date.Add(spin_year, (1, 1), flag=wx.LEFT, border=5)
        lyt_date.Add(spin_month, (1, 2))
        lyt_date.Add(spin_day, (1, 3))

        lyt_uknwn1 = BoxSizer(wx.HORIZONTAL)
        lyt_uknwn1.Add(txt_unknown1, 0, wx.ALIGN_CENTER_VERTICAL)
        lyt_uknwn1.Add(ti_unknown1, 0, wx.LEFT, 5)

        lyt_uknwn2 = BoxSizer(wx.HORIZONTAL)
        lyt_uknwn2.Add(txt_unknown2, 0, wx.ALIGN_CENTER_VERTICAL)
        lyt_uknwn2.Add(ti_unknown2, 0, wx.LEFT, 5)

        # Change orientation of main sizer to vertical
        self.lyt_main = BoxSizer(wx.VERTICAL)
        self.lyt_main.Add(lyt_section, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_date, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_uknwn1, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_uknwn2, 0, wx.TOP, 5)

        self.Panel.SetSizer(self.lyt_main)
Exemplo n.º 21
0
 def SetForegroundColour(self, *args, **kwargs):
     self.MainCtrl.SetForegroundColour(*args, **kwargs)
     return BorderedPanel.SetForegroundColour(self, *args, **kwargs)
Exemplo n.º 22
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.DEPENDS)

		## Override default label
		self.Label = GT(u'Dependencies and Conflicts')

		# Bypass checking this page for build
		self.prebuild_check = False

		# Buttons to open, save, & preview control file
		self.btn_open = CreateButton(self, btnid.BROWSE, GT(u'Browse'), u'browse', name=u'btn browse')
		self.btn_save = CreateButton(self, btnid.SAVE, GT(u'Save'), u'save', name=u'btn save')
		self.btn_preview = CreateButton(self, btnid.PREVIEW, GT(u'Preview'), u'preview', name=u'btn preview')

		txt_package = wx.StaticText(self, label=GT(u'Dependency/Conflict Package Name'), name=u'package')
		txt_version = wx.StaticText(self, label=GT(u'Version'), name=u'version')

		self.ti_package = TextArea(self, size=(300,25), name=u'package')

		opts_operator = (
			u'>=',
			u'<=',
			u'=',
			u'>>',
			u'<<',
			)

		self.sel_operator = Choice(self, choices=opts_operator, name=u'operator')

		self.ti_version = TextArea(self, name=u'version')

		self.ti_package.SetSize((100,50))

		pnl_categories = BorderedPanel(self)

		self.DefaultCategory = u'Depends'

		rb_dep = wx.RadioButton(pnl_categories, label=GT(u'Depends'), name=self.DefaultCategory, style=wx.RB_GROUP)
		rb_pre = wx.RadioButton(pnl_categories, label=GT(u'Pre-Depends'), name=u'Pre-Depends')
		rb_rec = wx.RadioButton(pnl_categories, label=GT(u'Recommends'), name=u'Recommends')
		rb_sug = wx.RadioButton(pnl_categories, label=GT(u'Suggests'), name=u'Suggests')
		rb_enh = wx.RadioButton(pnl_categories, label=GT(u'Enhances'), name=u'Enhances')
		rb_con = wx.RadioButton(pnl_categories, label=GT(u'Conflicts'), name=u'Conflicts')
		rb_rep = wx.RadioButton(pnl_categories, label=GT(u'Replaces'), name=u'Replaces')
		rb_break = wx.RadioButton(pnl_categories, label=GT(u'Breaks'), name=u'Breaks')

		self.categories = (
			rb_dep, rb_pre, rb_rec,
			rb_sug, rb_enh, rb_con,
			rb_rep, rb_break,
		)

		# Buttons to add and remove dependencies from the list
		btn_add = CreateButton(self, btnid.ADD)
		btn_append = CreateButton(self, btnid.APPEND)
		btn_remove = CreateButton(self, btnid.REMOVE)
		btn_clear = CreateButton(self, btnid.CLEAR)

		# ----- List
		self.lst_deps = ListCtrlESS(self, inputid.LIST, name=u'list')
		self.lst_deps.SetSingleStyle(wx.LC_REPORT)
		self.lst_deps.InsertColumn(0, GT(u'Category'), width=150)
		self.lst_deps.InsertColumn(1, GT(u'Package(s)'))

		# wx 3.0 compatibility
		if wx.MAJOR_VERSION < 3:
			self.lst_deps.SetColumnWidth(100, wx.LIST_AUTOSIZE)

		SetPageToolTips(self)

		# *** Event Handling *** #

		wx.EVT_KEY_DOWN(self.ti_package, self.SetDepends)
		wx.EVT_KEY_DOWN(self.ti_version, self.SetDepends)

		btn_add.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_append.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_remove.Bind(wx.EVT_BUTTON, self.SetDepends)
		btn_clear.Bind(wx.EVT_BUTTON, self.SetDepends)

		wx.EVT_KEY_DOWN(self.lst_deps, self.SetDepends)

		# *** Layout *** #

		LEFT_BOTTOM = lyt.ALGN_LB

		lyt_top = wx.GridBagSizer()
		lyt_top.SetCols(6)
		lyt_top.AddGrowableCol(3)

		# Row 1
		lyt_top.Add(txt_package, (1, 0), flag=LEFT_BOTTOM)
		lyt_top.Add(txt_version, (1, 2), flag=LEFT_BOTTOM)
		lyt_top.Add(self.btn_open, (0, 3), (4, 1), wx.ALIGN_RIGHT)
		lyt_top.Add(self.btn_save, (0, 4), (4, 1))
		lyt_top.Add(self.btn_preview, (0, 5), (4, 1))

		# Row 2
		lyt_top.Add(self.ti_package, (2, 0), flag=wx.ALIGN_CENTER_VERTICAL)
		lyt_top.Add(self.sel_operator, (2, 1), flag=wx.ALIGN_CENTER_VERTICAL)
		lyt_top.Add(self.ti_version, (2, 2), flag=wx.ALIGN_CENTER_VERTICAL)

		lyt_categories = wx.GridSizer(4, 2, 5, 5)

		for C in self.categories:
			lyt_categories.Add(C, 0)

		pnl_categories.SetAutoLayout(True)
		pnl_categories.SetSizer(lyt_categories)
		pnl_categories.Layout()

		lyt_buttons = BoxSizer(wx.HORIZONTAL)

		lyt_buttons.AddMany((
			(btn_add, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_append, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_remove, 0, wx.ALIGN_CENTER_VERTICAL),
			(btn_clear, 0, wx.ALIGN_CENTER_VERTICAL),
			))

		lyt_mid = wx.GridBagSizer()
		lyt_mid.SetCols(2)

		lyt_mid.Add(wx.StaticText(self, label=u'Categories'), (0, 0), (1, 1), LEFT_BOTTOM)
		lyt_mid.Add(pnl_categories, (1, 0), flag=wx.RIGHT, border=5)
		lyt_mid.Add(lyt_buttons, (1, 1), flag=wx.ALIGN_BOTTOM)

		lyt_list = BoxSizer(wx.HORIZONTAL)
		lyt_list.Add(self.lst_deps, 1, wx.EXPAND)

		lyt_main = BoxSizer(wx.VERTICAL)
		# Spacer is less on this page because text is aligned to bottom
		lyt_main.AddSpacer(5)
		lyt_main.Add(lyt_top, 0, wx.EXPAND|lyt.PAD_LR, 5)
		lyt_main.Add(lyt_mid, 0, lyt.PAD_LR, 5)
		lyt_main.Add(lyt_list, 1, wx.EXPAND|wx.ALL, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Exemplo n.º 23
0
	def __init__(self, parent):
		BorderedPanel.__init__(self, parent)
Exemplo n.º 24
0
	def __init__(self, parent):
		WizardPage.__init__(self, parent, pgid.SCRIPTS)

		preinst = DebianScript(self, ID_INST_PRE)
		postinst = DebianScript(self, ID_INST_POST)
		prerm = DebianScript(self, ID_RM_PRE)
		postrm = DebianScript(self, ID_RM_POST)

		# Radio buttons for displaying between pre- and post- install scripts
		# FIXME: Names settings for tooltips are confusing
		rb_preinst = wx.RadioButton(self, preinst.GetId(), preinst.GetName(),
				name=preinst.FileName, style=wx.RB_GROUP)
		rb_postinst = wx.RadioButton(self, postinst.GetId(), postinst.GetName(),
				name=postinst.FileName)
		rb_prerm = wx.RadioButton(self, prerm.GetId(), prerm.GetName(),
				name=prerm.FileName)
		rb_postrm = wx.RadioButton(self, postrm.GetId(), postrm.GetName(),
				name=postrm.FileName)

		self.script_objects = (
			(preinst, rb_preinst,),
			(postinst, rb_postinst,),
			(prerm, rb_prerm,),
			(postrm, rb_postrm,),
			)

		# *** Auto-Link *** #

		pnl_autolink = BorderedPanel(self)

		# Auto-Link path for new link
		txt_autolink = wx.StaticText(pnl_autolink, label=GT(u'Path'), name=u'target')
		self.ti_autolink = PathCtrl(pnl_autolink, value=u'/usr/bin', warn=True)
		self.ti_autolink.SetName(u'target')
		self.ti_autolink.Default = self.ti_autolink.GetValue()

		# Auto-Link executables to be linked
		self.Executables = BasicFileList(pnl_autolink, size=(200, 200), hlExe=True,
				name=u'al list')

		# Auto-Link import, generate and remove buttons
		btn_al_import = CreateButton(pnl_autolink, btnid.IMPORT)
		btn_al_remove = CreateButton(pnl_autolink, btnid.REMOVE)
		btn_al_generate = CreateButton(pnl_autolink, image=u'build')

		# Auto-Link help
		btn_help = CreateButton(pnl_autolink, btnid.HELP, size=64)

		# Initialize script display
		self.ScriptSelect(None)

		SetPageToolTips(self)

		# *** Event Handling *** #

		for DS, RB in self.script_objects:
			wx.EVT_RADIOBUTTON(RB, RB.GetId(), self.ScriptSelect)

		wx.EVT_BUTTON(btn_al_import, btnid.IMPORT, self.ImportExes)
		wx.EVT_BUTTON(btn_al_generate, wx.ID_ANY, self.OnGenerate)
		wx.EVT_BUTTON(btn_al_remove, btnid.REMOVE, self.ImportExes)
		wx.EVT_BUTTON(btn_help, btnid.HELP, self.OnHelpButton)

		# *** Layout *** #

		# Organizing radio buttons
		lyt_sel_script = BoxSizer(wx.HORIZONTAL)
		lyt_sel_script.AddMany((
			(rb_preinst),
			(rb_postinst),
			(rb_prerm),
			(rb_postrm),
			))

		# Sizer for left half of scripts panel
		lyt_left = BoxSizer(wx.VERTICAL)
		lyt_left.Add(lyt_sel_script, 0, wx.EXPAND|wx.BOTTOM, 5)

		for DS, RB in self.script_objects:
			lyt_left.Add(DS, 1, wx.EXPAND)

		# Auto-Link/Right side
		lyt_ti_autolink = BoxSizer(wx.HORIZONTAL)
		lyt_ti_autolink.Add(txt_autolink, 0, lyt.ALGN_C)
		lyt_ti_autolink.Add(self.ti_autolink, 1, lyt.ALGN_C)

		lyt_btn_autolink = BoxSizer(wx.HORIZONTAL)
		lyt_btn_autolink.Add(btn_al_import, 0)
		lyt_btn_autolink.Add(btn_al_remove, 0, lyt.PAD_LR, 5)
		lyt_btn_autolink.Add(btn_al_generate, 0)

		lyt_autolink = BoxSizer(wx.VERTICAL)
		lyt_autolink.Add(lyt_ti_autolink, 0, wx.EXPAND|lyt.PAD_LRT, 5)
		lyt_autolink.Add(self.Executables, 3, wx.EXPAND|lyt.PAD_LRT, 5)
		lyt_autolink.Add(lyt_btn_autolink, 0, lyt.ALGN_CH)
		lyt_autolink.Add(btn_help, 1, lyt.ALGN_C)

		pnl_autolink.SetSizer(lyt_autolink)
		pnl_autolink.SetAutoLayout(True)
		pnl_autolink.Layout()

		# Sizer for right half of scripts panel
		lyt_right = BoxSizer(wx.VERTICAL)
		# Line up panels to look even
		lyt_right.AddSpacer(44)
		lyt_right.Add(wx.StaticText(self, label=GT(u'Auto-Link Executables')),
				0, lyt.ALGN_LB)
		lyt_right.Add(pnl_autolink, 0, wx.EXPAND)

		lyt_main = BoxSizer(wx.HORIZONTAL)
		lyt_main.Add(lyt_left, 1, wx.EXPAND|wx.ALL, 5)
		lyt_main.Add(lyt_right, 0, wx.ALL, 5)

		self.SetAutoLayout(True)
		self.SetSizer(lyt_main)
		self.Layout()
Exemplo n.º 25
0
    def Enable(self, *args, **kwargs):
        self.MainCtrl.Enable(*args, **kwargs)

        return BorderedPanel.Enable(self, *args, **kwargs)
Exemplo n.º 26
0
    def __init__(self, parent):
        WizardPage.__init__(self, parent, pgid.SCRIPTS)

        preinst = DebianScript(self, ID_INST_PRE)
        postinst = DebianScript(self, ID_INST_POST)
        prerm = DebianScript(self, ID_RM_PRE)
        postrm = DebianScript(self, ID_RM_POST)

        # Check boxes for choosing scripts
        chk_preinst = CheckBox(self,
                               ID_INST_PRE,
                               GT(u'Make this script'),
                               name=GT(u'Pre-Install'))
        preinst.SetCheckBox(chk_preinst)
        chk_postinst = CheckBox(self,
                                ID_INST_POST,
                                GT(u'Make this script'),
                                name=GT(u'Post-Install'))
        postinst.SetCheckBox(chk_postinst)
        chk_prerm = CheckBox(self,
                             ID_RM_PRE,
                             GT(u'Make this script'),
                             name=GT(u'Pre-Remove'))
        prerm.SetCheckBox(chk_prerm)
        chk_postrm = CheckBox(self,
                              ID_RM_POST,
                              GT(u'Make this script'),
                              name=GT(u'Post-Remove'))
        postrm.SetCheckBox(chk_postrm)

        for S in chk_preinst, chk_postinst, chk_prerm, chk_postrm:
            S.SetToolTipString(u'{} {}'.format(
                S.GetName(), GT(u'script will be created from text below')))

            S.Bind(wx.EVT_CHECKBOX, self.OnToggleScripts)

        # Radio buttons for displaying between pre- and post- install scripts
        # FIXME: Names settings for tooltips are confusing
        rb_preinst = wx.RadioButton(self,
                                    preinst.GetId(),
                                    GT(u'Pre-Install'),
                                    name=preinst.FileName,
                                    style=wx.RB_GROUP)
        rb_postinst = wx.RadioButton(self,
                                     postinst.GetId(),
                                     GT(u'Post-Install'),
                                     name=postinst.FileName)
        rb_prerm = wx.RadioButton(self,
                                  prerm.GetId(),
                                  GT(u'Pre-Remove'),
                                  name=prerm.FileName)
        rb_postrm = wx.RadioButton(self,
                                   postrm.GetId(),
                                   GT(u'Post-Remove'),
                                   name=postrm.FileName)

        # TODO: Remove check boxes from lists (no longer needed)
        self.script_objects = (
            (
                preinst,
                chk_preinst,
                rb_preinst,
            ),
            (
                postinst,
                chk_postinst,
                rb_postinst,
            ),
            (
                prerm,
                chk_prerm,
                rb_prerm,
            ),
            (
                postrm,
                chk_postrm,
                rb_postrm,
            ),
        )

        for DS, CHK, RB in self.script_objects:
            CHK.Hide()

        # Set script text areas to default enabled/disabled setting
        self.OnToggleScripts()

        # *** Auto-Link *** #

        pnl_autolink = BorderedPanel(self)

        # Auto-Link path for new link
        txt_autolink = wx.StaticText(pnl_autolink,
                                     label=GT(u'Path'),
                                     name=u'target')
        self.ti_autolink = PathCtrl(pnl_autolink,
                                    value=u'/usr/bin',
                                    defaultValue=u'/usr/bin',
                                    warn=True)
        self.ti_autolink.SetName(u'target')
        self.ti_autolink.Default = self.ti_autolink.GetValue()

        # Auto-Link executables to be linked
        self.Executables = BasicFileList(pnl_autolink,
                                         size=(200, 200),
                                         hlExe=True,
                                         name=u'al list')

        # Auto-Link import, generate and remove buttons
        btn_al_import = CreateButton(pnl_autolink, btnid.IMPORT)
        btn_al_remove = CreateButton(pnl_autolink, btnid.REMOVE)
        btn_al_generate = CreateButton(pnl_autolink, image=u'build')

        # Auto-Link help
        btn_help = CreateButton(pnl_autolink, btnid.HELP, size=64)

        # Initialize script display
        self.ScriptSelect(None)

        SetPageToolTips(self)

        # *** Event Handling *** #

        for DS, CHK, RB in self.script_objects:
            RB.Bind(wx.EVT_RADIOBUTTON, self.ScriptSelect)

        wx.EVT_BUTTON(btn_al_import, btnid.IMPORT, self.ImportExes)
        wx.EVT_BUTTON(btn_al_generate, wx.ID_ANY, self.OnGenerate)
        wx.EVT_BUTTON(btn_al_remove, btnid.REMOVE, self.ImportExes)
        wx.EVT_BUTTON(btn_help, btnid.HELP, self.OnHelpButton)

        # *** Layout *** #

        # Organizing radio buttons
        lyt_sel_script = BoxSizer(wx.HORIZONTAL)
        lyt_sel_script.AddMany((
            (chk_preinst),
            (chk_postinst),
            (chk_prerm),
            (chk_postrm),
        ))

        lyt_sel_script.AddStretchSpacer(1)

        lyt_sel_script.AddMany((
            (rb_preinst),
            (rb_postinst),
            (rb_prerm),
            (rb_postrm),
        ))

        # Sizer for left half of scripts panel
        lyt_left = BoxSizer(wx.VERTICAL)
        lyt_left.Add(lyt_sel_script, 0, wx.EXPAND | wx.BOTTOM, 5)

        for DS, CHK, RB, in self.script_objects:
            lyt_left.Add(DS, 1, wx.EXPAND)

        # Auto-Link/Right side
        lyt_ti_autolink = BoxSizer(wx.HORIZONTAL)
        lyt_ti_autolink.Add(txt_autolink, 0, lyt.ALGN_C)
        lyt_ti_autolink.Add(self.ti_autolink, 1, lyt.ALGN_C)

        lyt_btn_autolink = BoxSizer(wx.HORIZONTAL)
        lyt_btn_autolink.Add(btn_al_import, 0)
        lyt_btn_autolink.Add(btn_al_remove, 0, lyt.PAD_LR, 5)
        lyt_btn_autolink.Add(btn_al_generate, 0)

        lyt_autolink = BoxSizer(wx.VERTICAL)
        lyt_autolink.Add(lyt_ti_autolink, 0, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_autolink.Add(self.Executables, 3, wx.EXPAND | lyt.PAD_LRT, 5)
        lyt_autolink.Add(lyt_btn_autolink, 0, lyt.ALGN_CH)
        lyt_autolink.Add(btn_help, 1, lyt.ALGN_C)

        pnl_autolink.SetSizer(lyt_autolink)
        pnl_autolink.SetAutoLayout(True)
        pnl_autolink.Layout()

        # Sizer for right half of scripts panel
        lyt_right = BoxSizer(wx.VERTICAL)
        # Line up panels to look even
        lyt_right.AddSpacer(32)
        lyt_right.Add(wx.StaticText(self, label=GT(u'Auto-Link Executables')),
                      0, lyt.ALGN_LB)
        lyt_right.Add(pnl_autolink, 0, wx.EXPAND)

        lyt_main = BoxSizer(wx.HORIZONTAL)
        lyt_main.Add(lyt_left, 1, wx.EXPAND | wx.ALL, 5)
        lyt_main.Add(lyt_right, 0, lyt.PAD_RB, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()
Exemplo n.º 27
0
 def GetPanelStyle(self, *args, **kwargs):
     return BorderedPanel.GetWindowStyle(self, *args, **kwargs)
Exemplo n.º 28
0
class ManBanner(ManSectBase):
    def __init__(self, parent):
        ManSectBase.__init__(self, parent)

        self.Panel = BorderedPanel(parent)

        txt_section = wx.StaticText(self.Panel, label=GT(u'Section'))

        self.sel_section = Choice(self.Panel, choices=tuple(sections))
        self.sel_section.Default = u'1'
        self.sel_section.SetStringSelection(self.sel_section.Default)

        # Section description that changes with EVT_CHOICE
        self.LabelSection = wx.StaticText(self.Panel)
        self.SetSectionLabel()

        txt_date = wx.StaticText(self.Panel, label=GT(u'Date'))
        spin_year = wx.SpinCtrl(self.Panel,
                                min=1900,
                                max=2100,
                                initial=GetYear(string_value=False))
        spin_month = wx.SpinCtrl(self.Panel,
                                 min=1,
                                 max=12,
                                 initial=GetMonthInt())
        spin_day = wx.SpinCtrl(self.Panel, min=1, max=31, initial=GetDayInt())

        # FIXME: What is this for?
        txt_unknown1 = wx.StaticText(self.Panel, label=GT(u'Unknown'))
        ti_unknown1 = wx.TextCtrl(self.Panel)

        # FIXME: What is this for?
        txt_unknown2 = wx.StaticText(self.Panel, label=GT(u'Unknown'))
        ti_unknown2 = wx.TextCtrl(self.Panel)

        # *** Event Handling *** #

        self.sel_section.Bind(wx.EVT_CHOICE, self.OnSetSection)

        # *** Layout *** #

        lyt_section = BoxSizer(wx.HORIZONTAL)
        lyt_section.Add(txt_section, 0, wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER,
                        5)
        lyt_section.Add(self.sel_section, 0,
                        wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 5)
        lyt_section.Add(self.LabelSection, 0,
                        wx.LEFT | wx.RIGHT | wx.ALIGN_CENTER, 5)

        lyt_date = wx.GridBagSizer()
        lyt_date.Add(txt_date, (1, 0), flag=wx.ALIGN_CENTER_VERTICAL)
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Year')), (0, 1))
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Month')), (0, 2))
        lyt_date.Add(wx.StaticText(self.Panel, label=GT(u'Day')), (0, 3))
        lyt_date.Add(spin_year, (1, 1), flag=wx.LEFT, border=5)
        lyt_date.Add(spin_month, (1, 2))
        lyt_date.Add(spin_day, (1, 3))

        lyt_uknwn1 = BoxSizer(wx.HORIZONTAL)
        lyt_uknwn1.Add(txt_unknown1, 0, wx.ALIGN_CENTER_VERTICAL)
        lyt_uknwn1.Add(ti_unknown1, 0, wx.LEFT, 5)

        lyt_uknwn2 = BoxSizer(wx.HORIZONTAL)
        lyt_uknwn2.Add(txt_unknown2, 0, wx.ALIGN_CENTER_VERTICAL)
        lyt_uknwn2.Add(ti_unknown2, 0, wx.LEFT, 5)

        # Change orientation of main sizer to vertical
        self.lyt_main = BoxSizer(wx.VERTICAL)
        self.lyt_main.Add(lyt_section, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_date, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_uknwn1, 0, wx.TOP, 5)
        self.lyt_main.Add(lyt_uknwn2, 0, wx.TOP, 5)

        self.Panel.SetSizer(self.lyt_main)

    ## Retrieve main object instance
    def GetPanel(self):
        return self.Panel

    ## TODO: Doxygen
    def OnSetSection(self, event=None):
        self.SetSectionLabel(self.sel_section.GetStringSelection())

    ## Updates the label for the current section
    def SetSectionLabel(self, section=None):
        if section == None:
            section = self.sel_section.GetStringSelection()

        if section in sections:
            Logger.Debug(__name__, u'Setting section to {}'.format(section))

            self.LabelSection.SetLabel(sections[section])
            return True

        return False
Exemplo n.º 29
0
 def SetPanelStyleFlag(self, *args, **kwargs):
     return BorderedPanel.SetWindowStyleFlag(self, *args, **kwargs)
Exemplo n.º 30
0
 def __init__(self, parent):
     BorderedPanel.__init__(self, parent)
Exemplo n.º 31
0
    def __init__(self):
        BaseDialog.__init__(self,
                            title=GT(u'Update Dist Names Cache'),
                            style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.SetMinSize(wx.Size(300, 150))

        txt_types = wx.StaticText(self, label=GT(u'Include the following:'))

        pnl_types = BorderedPanel(self)

        self.chk_unstable = wx.CheckBox(pnl_types, label=GT(u'Unstable'))
        self.chk_obsolete = wx.CheckBox(pnl_types, label=GT(u'Obsolete'))
        self.chk_generic = wx.CheckBox(
            pnl_types, label=GT(u'Generic (Debian names only)'))

        self.btn_preview = wx.Button(self, label=GT(u'Preview cache'))
        btn_update = wx.Button(self, label=GT(u'Update cache'))
        btn_clear = wx.Button(self, label=GT(u'Clear cache'))

        # Keep preview dialog in memory so position/size is saved
        self.preview = TextPreview(self,
                                   title=GT(u'Available Distribution Names'),
                                   size=(500, 400))

        # Is instantiated as ProgressDialog when OnUpdateCache is called
        self.progress = None
        self.timer = DebreateTimer(self)

        # For setting error messages from other threads
        self.error_message = None

        # *** Event Handling *** #

        self.btn_preview.Bind(wx.EVT_BUTTON, self.OnPreviewCache)
        btn_update.Bind(wx.EVT_BUTTON, self.OnUpdateCache)
        btn_clear.Bind(wx.EVT_BUTTON, self.OnClearCache)

        self.Bind(wx.EVT_TIMER, self.OnTimerEvent)
        self.Bind(EVT_TIMER_STOP, self.OnTimerStop)

        # *** Layout *** #

        lyt_types = BoxSizer(wx.VERTICAL)
        lyt_types.AddSpacer(5)

        for CHK in (
                self.chk_unstable,
                self.chk_obsolete,
                self.chk_generic,
        ):
            lyt_types.Add(CHK, 0, lyt.PAD_LR, 5)

        lyt_types.AddSpacer(5)

        pnl_types.SetAutoLayout(True)
        pnl_types.SetSizerAndFit(lyt_types)
        pnl_types.Layout()

        lyt_buttons = BoxSizer(wx.HORIZONTAL)
        lyt_buttons.Add(self.btn_preview, 1)
        lyt_buttons.Add(btn_update, 1)
        lyt_buttons.Add(btn_clear, 1)

        lyt_main = BoxSizer(wx.VERTICAL)
        lyt_main.Add(txt_types, 0, wx.ALIGN_CENTER | lyt.PAD_LRT, 5)
        lyt_main.Add(pnl_types, 0, wx.ALIGN_CENTER | lyt.PAD_LR, 5)
        lyt_main.Add(lyt_buttons, 1, wx.ALIGN_CENTER | wx.ALL, 5)

        self.SetAutoLayout(True)
        self.SetSizer(lyt_main)
        self.Layout()

        # *** Post-layout Actions *** #

        if not os.path.isfile(FILE_distnames):
            self.btn_preview.Disable()

        if self.Parent:
            self.CenterOnParent()