def __init__(self, parent):
        assert(isinstance(parent, gtk_view.gtk_view))
        self._parent = parent
        self.builder = make_builder('glade/deal_editor.glade')
        def shorter(name):
            return self.builder.get_object(name)
        w = self.builder.get_object("deal_editor")
        w.add_buttons(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        
        ##########
        # hiders #
        ##########
        self.hiders = []
        for (hcb, box) in [("deal_editor_change_datetime", "deal_editor_datetime_box"),
                           ("deal_editor_change_direction", "deal_editor_direction_box"),
                           ("deal_editor_change_account", "deal_adder_account1"),
                           ("deal_editor_change_instrument", "deal_editor_instrument"),
                           ("deal_editor_change_price", "deal_adder_price1"),
                           ("deal_editor_change_count", "deal_adder_count1"),
                           ("deal_editor_change_commission", "deal_editor_commission")]:
            cb = self.builder.get_object(hcb)
            bb = self.builder.get_object(box)
            self.hiders.append(hide_control(cb, [bb]))
            pass

        ####################
        # datetime control #
        ####################
        self.datetime = datetime_control(shorter("deal_adder_calendar1"),
                                         time_control(shorter("deal_adder_hour1"),
                                                      shorter("deal_adder_min1"),
                                                      shorter("deal_adder_sec1")),
                                         checkbutton = shorter("deal_editor_change_datetime"),
                                         year = shorter("deal_editor_year"),
                                         month = shorter("deal_editor_month"),
                                         day = shorter("deal_editor_day"))

        self.instrument = combo_select_control(shorter("deal_editor_instrument"),
                                               checkbutton = shorter("deal_editor_change_instrument"))

        self.price = number_control(shorter("deal_adder_price1"), shorter("deal_editor_change_price"), step_incr = 0.1, digits = 4)
        self.count = number_control(shorter("deal_adder_count1"), shorter("deal_editor_change_count"))
        self.commission = number_control(shorter("deal_editor_commission"), shorter("deal_editor_change_commission"), step_incr = 0.1, digits = 4)
        for name in ["deal_adder_price1", "deal_adder_count1", "deal_editor_commission"]:
            m = shorter(name)
            m.get_adjustment().set_all(lower = 0, upper = sys.float_info.max)
        self.account = combo_select_control(shorter("deal_adder_account1"),
                                            checkbutton = shorter("deal_editor_change_account"))
        self.direction = select_control({-1 : shorter("deal_adder_buy_rb1"),
                                         1 : shorter("deal_adder_sell_rb1")}, shorter("deal_editor_change_direction"))
    def __init__(self, parent):
        self._parent = parent
        self.builder = make_builder('glade/padder.glade')
        def shorter(name):
            return self.builder.get_object(name)
        w = shorter("padder")
        w.set_transient_for(self._parent.window.builder.get_object('main_window'))
        w.add_buttons(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        self.hiders = [hide_control(shorter("padder_calendars"), [shorter("padder_lower_calendar"), shorter("padder_upper_calendar")], hide = True)]
        self.start_date = datetime_control(shorter("padder_lower_calendar"),
                                           time_control(*map(lambda a: shorter(u'padder_lower_{0}'.format(a)), ["hour", "min", "sec"])),
                                           year = shorter("padder_lower_year"),
                                           month = shorter("padder_lower_month"),
                                           day = shorter("padder_lower_day"))
        
        self.end_date = datetime_control(shorter("padder_upper_calendar"),
                                         time_control(*map(lambda a: shorter(u'padder_upper_{0}'.format(a)), ["hour", "min", "sec"])),
                                         year = shorter("padder_upper_year"),
                                         month = shorter("padder_upper_month"),
                                         day = shorter("padder_upper_day"))
                                           
        self.datetime_start_end = datetime_start_end_control(self.start_date, self.end_date)
        self.price = number_range_control(number_control(shorter("padder_open"), step_incr = 0.1, digits = 4),
                                          number_control(shorter("padder_close"), step_incr = 0.1, digits = 4))
        self.price.set_lower_limit(0)
        self.price.set_upper_limit(sys.float_info.max)

        self.commission = number_range_control(number_control(shorter("padder_open_comm"), step_incr = 0.1, digits = 4),
                                               number_control(shorter("padder_close_comm"), step_incr = 0.1, digits = 4))
        self.commission.set_lower_limit(0)
        self.commission.set_upper_limit(sys.float_info.max)

        self.instrument = combo_select_control(shorter("padder_instrument"))
        self.account = combo_select_control(shorter('padder_account'))
        self.long_short = select_control({-1 : shorter("padder_long"),
                                          1 : shorter("padder_short")})
        self.count =  number_control(shorter("padder_count"))
        self.count.set_lower_limit(0)
        self.count.set_upper_limit(sys.maxint)
        shorter("edit_instruments").connect("clicked", self.edit_instruments_clicked)
    def __init__(self, parent):
        """
        \param parent \ref gtk_view.gtk_view instance
        """
        assert isinstance(parent, gtk_view.gtk_view)
        self.builder = make_builder("glade/deal_adder.glade")
        self._parent = parent

        def shorter(name):
            return self.builder.get_object("deal_adder_{0}".format(name))

        w = self.builder.get_object("deal_adder")
        w.set_transient_for(self._parent.window.builder.get_object("main_window"))
        w.add_buttons(gtk.STOCK_SAVE, gtk.RESPONSE_ACCEPT, gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
        self.datetime = datetime_control(
            shorter("calendar"),
            time_control(shorter("hour"), shorter("min"), shorter("sec")),
            year=shorter("year"),
            month=shorter("month"),
            day=shorter("day"),
        )
        self.account = combo_select_control(shorter("account"))
        self.instrument = combo_select_control(shorter("instrument"))
        # self.market = combo_control(shorter("market"))
        self.price = number_control(shorter("price"), step_incr=0.1, digits=4)
        self.price.set_lower_limit(0)
        self.price.set_upper_limit(sys.float_info.max)
        self.count = number_control(shorter("count"))
        self.count.set_lower_limit(0)
        self.count.set_upper_limit(sys.maxint)
        self.direction = select_control({-1: shorter("buy_rb"), 1: shorter("sell_rb")})
        self.commission = number_control(shorter("comm"), step_incr=0.1, digits=4)
        self.commission.set_lower_limit(0)
        self.commission.set_upper_limit(sys.float_info.max)
        self.attributes = attributes_control(
            shorter("attributes"), shorter("attr_name"), shorter("attr_val"), shorter("attr_add"), shorter("attr_del")
        )
        self.edit_instruments = shorter("edit_instruments")
        self.edit_instruments.connect("clicked", self.edit_clicked)