`scripts` -> `subcommands`, add logic to `lib`
This commit is contained in:
parent
eb11d2dc2a
commit
006c010907
|
@ -5,7 +5,7 @@ import signal
|
|||
|
||||
from sqlalchemy import or_, and_
|
||||
|
||||
from .models import User, Product
|
||||
from ..models import User, Product
|
||||
|
||||
def search_user(string, session, ignorethisflag=None):
|
||||
string = string.lower()
|
|
@ -5,8 +5,8 @@ import datetime
|
|||
from collections import defaultdict
|
||||
|
||||
from .helpers import *
|
||||
from .models import Transaction
|
||||
from .db import Session
|
||||
from ..models import Transaction
|
||||
from ..db import Session
|
||||
|
||||
def getUser():
|
||||
while 1:
|
|
@ -35,15 +35,15 @@ def main():
|
|||
config.read(args.config)
|
||||
|
||||
if args.subcommand == 'loop':
|
||||
import dibbler.text_based as text_based
|
||||
text_based.main()
|
||||
import dibbler.subcommands.loop as loop
|
||||
loop.main()
|
||||
|
||||
elif args.subcommand == 'create-db':
|
||||
import dibbler.scripts.makedb as makedb
|
||||
import dibbler.subcommands.makedb as makedb
|
||||
makedb.main()
|
||||
|
||||
elif args.subcommand == 'slabbedasker':
|
||||
import dibbler.scripts.slabbedasker as slabbedasker
|
||||
import dibbler.subcommands.slabbedasker as slabbedasker
|
||||
slabbedasker.main()
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .addstock import AddStockMenu
|
||||
from .buymenu import BuyMenu
|
||||
from .editing import (
|
||||
|
@ -28,10 +26,3 @@ from .stats import (
|
|||
BalanceMenu,
|
||||
LoggedStatisticsMenu
|
||||
)
|
||||
|
||||
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
|
||||
help_commands = ['help', '?']
|
||||
context_commands = ['what', '??']
|
||||
local_help_commands = ['help!', '???']
|
||||
faq_commands = ['faq']
|
||||
restart_commands = ['restart']
|
|
@ -7,19 +7,17 @@ from select import select
|
|||
|
||||
from dibbler.db import Session
|
||||
from dibbler.models import User
|
||||
from dibbler.helpers import (
|
||||
from dibbler.lib.helpers import (
|
||||
search_user,
|
||||
search_product,
|
||||
guess_data_type,
|
||||
argmax,
|
||||
)
|
||||
|
||||
from . import (
|
||||
context_commands,
|
||||
local_help_commands,
|
||||
help_commands,
|
||||
exit_commands,
|
||||
)
|
||||
exit_commands = ['exit', 'abort', 'quit', 'bye', 'eat flaming death', 'q']
|
||||
help_commands = ['help', '?']
|
||||
context_commands = ['what', '??']
|
||||
local_help_commands = ['help!', '???']
|
||||
|
||||
|
||||
class ExitMenu(Exception):
|
||||
|
|
|
@ -6,11 +6,12 @@ import sys
|
|||
|
||||
from dibbler.db import Session
|
||||
|
||||
from . import faq_commands, restart_commands
|
||||
from .buymenu import BuyMenu
|
||||
from .faq import FAQMenu
|
||||
from .helpermenus import Menu
|
||||
|
||||
faq_commands = ['faq']
|
||||
restart_commands = ['restart']
|
||||
|
||||
def restart():
|
||||
# Does not work if the script is not executable, or if it was
|
||||
|
|
|
@ -2,7 +2,7 @@ import sqlalchemy
|
|||
|
||||
from dibbler.conf import config
|
||||
from dibbler.models import Transaction, Product, User
|
||||
from dibbler.helpers import less
|
||||
from dibbler.lib.helpers import less
|
||||
|
||||
from .helpermenus import Menu, Selector
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import re
|
|||
|
||||
from dibbler.conf import config
|
||||
from dibbler.models import Product, User
|
||||
from dibbler.printer_helpers import print_bar_code, print_name_label
|
||||
from dibbler.lib.printer_helpers import print_bar_code, print_name_label
|
||||
|
||||
from .helpermenus import Menu
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from sqlalchemy import desc, func
|
||||
|
||||
from dibbler.helpers import less
|
||||
from dibbler.lib.helpers import less
|
||||
from dibbler.models import PurchaseEntry, Product, User
|
||||
from dibbler.statistikkHelpers import statisticsTextOnly
|
||||
from dibbler.lib.statistikkHelpers import statisticsTextOnly
|
||||
|
||||
from .helpermenus import Menu
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ import random
|
|||
import sys
|
||||
import traceback
|
||||
|
||||
from .conf import config
|
||||
from .helpers import *
|
||||
from .menus import *
|
||||
from ..conf import config
|
||||
from ..lib.helpers import *
|
||||
from ..menus import *
|
||||
|
||||
random.seed()
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
import matplotlib.pyplot as plt
|
||||
import matplotlib.dates as mdates
|
||||
|
||||
from dibbler.statistikkHelpers import *
|
||||
from dibbler.lib.statistikkHelpers import *
|
||||
|
||||
def getInputType():
|
||||
inp = 0
|
Loading…
Reference in New Issue